@@ -42,6 +42,7 @@ public function setUp()
42
42
$ this ->installer = $ this ->getMock ('\Magento\Setup\Model\Installer ' , [], [], '' , false );
43
43
$ this ->progressFactory = $ this ->getMock ('\Magento\Setup\Model\Installer\ProgressFactory ' , [], [], '' , false );
44
44
$ this ->sampleDataState = $ this ->getMock ('\Magento\Framework\Setup\SampleData\State ' , [], [], '' , false );
45
+
45
46
$ installerFactory ->expects ($ this ->once ())->method ('create ' )->with ($ this ->webLogger )
46
47
->willReturn ($ this ->installer );
47
48
$ this ->controller = new Install (
@@ -100,6 +101,8 @@ public function testProgressAction()
100
101
{
101
102
$ numValue = 42 ;
102
103
$ consoleMessages = ['key1 ' => 'log message 1 ' , 'key2 ' => 'log message 2 ' ];
104
+
105
+ $ this ->webLogger ->expects ($ this ->once ())->method ('logfileExists ' )->willReturn (true );
103
106
$ progress = $ this ->getMock ('\Magento\Setup\Model\Installer\Progress ' , [], [], '' , false );
104
107
$ this ->progressFactory ->expects ($ this ->once ())->method ('createFromLog ' )->with ($ this ->webLogger )
105
108
->willReturn ($ progress );
@@ -119,6 +122,7 @@ public function testProgressAction()
119
122
public function testProgressActionWithError ()
120
123
{
121
124
$ e = 'Some exception message ' ;
125
+ $ this ->webLogger ->expects ($ this ->once ())->method ('logfileExists ' )->willReturn (true );
122
126
$ this ->progressFactory ->expects ($ this ->once ())->method ('createFromLog ' )
123
127
->will ($ this ->throwException (new \LogicException ($ e )));
124
128
$ jsonModel = $ this ->controller ->progressAction ();
@@ -134,6 +138,7 @@ public function testProgressActionWithError()
134
138
public function testProgressActionWithSampleDataError ()
135
139
{
136
140
$ numValue = 42 ;
141
+ $ this ->webLogger ->expects ($ this ->once ())->method ('logfileExists ' )->willReturn (true );
137
142
$ progress = $ this ->getMock ('\Magento\Setup\Model\Installer\Progress ' , [], [], '' , false );
138
143
$ progress ->expects ($ this ->once ())->method ('getRatio ' )->willReturn ($ numValue );
139
144
$ this ->progressFactory ->expects ($ this ->once ())->method ('createFromLog ' )->willReturn ($ progress );
@@ -148,6 +153,19 @@ public function testProgressActionWithSampleDataError()
148
153
$ this ->assertSame (sprintf ('%d ' , $ numValue * 100 ), $ variables ['progress ' ]);
149
154
}
150
155
156
+ public function testProgressActionNoInstallLogFile ()
157
+ {
158
+ $ this ->webLogger ->expects ($ this ->once ())->method ('logfileExists ' )->willReturn (false );
159
+ $ jsonModel = $ this ->controller ->progressAction ();
160
+ $ this ->assertInstanceOf ('\Zend\View\Model\JsonModel ' , $ jsonModel );
161
+ $ variables = $ jsonModel ->getVariables ();
162
+ $ this ->assertArrayHasKey ('success ' , $ variables );
163
+ $ this ->assertArrayHasKey ('console ' , $ variables );
164
+ $ this ->assertTrue ($ variables ['success ' ]);
165
+ $ this ->assertEmpty ($ variables ['console ' ]);
166
+ $ this ->assertSame (0 , $ variables ['progress ' ]);
167
+ }
168
+
151
169
public function testDispatch ()
152
170
{
153
171
$ request = $ this ->getMock ('\Zend\Http\PhpEnvironment\Request ' , [], [], '' , false );
0 commit comments