@@ -47,7 +47,6 @@ protected function setUp()
47
47
48
48
public function testGetAll ()
49
49
{
50
- $ this ->config ->expects ($ this ->once ())->method ('isAvailable ' )->willReturn (true );
51
50
$ this ->setLoadAllExpectation ();
52
51
$ this ->setLoadConfigExpectation ();
53
52
$ expected = ['foo ' => self ::$ allFixture ['foo ' ]];
@@ -58,15 +57,13 @@ public function testGetAll()
58
57
public function testGetAllNoData ()
59
58
{
60
59
$ this ->loader ->expects ($ this ->exactly (2 ))->method ('load ' )->willReturn ([]);
61
- $ this ->config ->expects ($ this ->never ())->method ('isAvailable ' );
62
60
$ this ->setLoadConfigExpectation (false );
63
61
$ this ->assertEquals ([], $ this ->model ->getAll ());
64
62
$ this ->assertEquals ([], $ this ->model ->getAll ());
65
63
}
66
64
67
65
public function testGetOne ()
68
66
{
69
- $ this ->config ->expects ($ this ->once ())->method ('isAvailable ' )->willReturn (true );
70
67
$ this ->setLoadAllExpectation ();
71
68
$ this ->setLoadConfigExpectation ();
72
69
$ this ->assertSame (['key ' => 'value ' ], $ this ->model ->getOne ('foo ' ));
@@ -75,7 +72,6 @@ public function testGetOne()
75
72
76
73
public function testGetNames ()
77
74
{
78
- $ this ->config ->expects ($ this ->once ())->method ('isAvailable ' )->willReturn (true );
79
75
$ this ->setLoadAllExpectation (false );
80
76
$ this ->setLoadConfigExpectation ();
81
77
$ this ->assertSame (['foo ' ], $ this ->model ->getNames ());
@@ -84,7 +80,6 @@ public function testGetNames()
84
80
85
81
public function testHas ()
86
82
{
87
- $ this ->config ->expects ($ this ->once ())->method ('isAvailable ' )->willReturn (true );
88
83
$ this ->setLoadAllExpectation (false );
89
84
$ this ->setLoadConfigExpectation ();
90
85
$ this ->assertTrue ($ this ->model ->has ('foo ' ));
@@ -93,15 +88,14 @@ public function testHas()
93
88
94
89
public function testIsModuleInfoAvailable ()
95
90
{
96
- $ this ->config ->expects ($ this ->once ())->method ('isAvailable ' )->willReturn (true );
97
91
$ this ->setLoadConfigExpectation (true );
98
92
$ this ->assertTrue ($ this ->model ->isModuleInfoAvailable ());
99
93
}
100
94
101
95
public function testIsModuleInfoAvailableNoConfig ()
102
96
{
103
- $ this ->config ->expects ($ this ->once ( ))->method ('isAvailable ' )->willReturn (true );
104
- $ this ->config ->expects ($ this ->once ( ))->method ('get ' )->willReturn (null );
97
+ $ this ->config ->expects ($ this ->at ( 0 ))->method ('get ' )->willReturn ([ ' modules ' => ' testModule ' ] );
98
+ $ this ->config ->expects ($ this ->at ( 1 ))->method ('get ' )->willReturn (null );
105
99
$ this ->assertFalse ($ this ->model ->isModuleInfoAvailable ());
106
100
}
107
101
@@ -114,7 +108,7 @@ public function testIsModuleInfoAvailableNoConfig()
114
108
private function setLoadConfigExpectation ($ isExpected = true )
115
109
{
116
110
if ($ isExpected ) {
117
- $ this ->config ->expects ($ this ->once ( ))->method ('get ' )->willReturn (self ::$ enabledFixture );
111
+ $ this ->config ->expects ($ this ->exactly ( 2 ))->method ('get ' )->willReturn (self ::$ enabledFixture );
118
112
} else {
119
113
$ this ->config ->expects ($ this ->never ())->method ('get ' );
120
114
}
0 commit comments