8
8
9
9
namespace Magento \Framework \App \Test \Unit ;
10
10
11
+ use Magento \Framework \App \Filesystem \DirectoryList ;
11
12
use \Magento \Framework \App \Bootstrap ;
12
- use \Magento \Framework \App \State ;
13
13
use \Magento \Framework \App \MaintenanceMode ;
14
-
15
- use Magento \Framework \App \Filesystem \DirectoryList ;
14
+ use \Magento \Framework \App \State ;
16
15
17
16
/**
18
17
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -64,6 +63,11 @@ class BootstrapTest extends \PHPUnit_Framework_TestCase
64
63
*/
65
64
protected $ bootstrapMock ;
66
65
66
+ /**
67
+ * @var \Magento\Framework\HTTP\PhpEnvironment\RemoteAddress | \PHPUnit_Framework_MockObject_MockObject
68
+ */
69
+ protected $ remoteAddress ;
70
+
67
71
protected function setUp ()
68
72
{
69
73
$ this ->objectManagerFactory = $ this ->getMock (
@@ -82,6 +86,7 @@ protected function setUp()
82
86
false
83
87
);
84
88
$ this ->maintenanceMode = $ this ->getMock (\Magento \Framework \App \MaintenanceMode::class, ['isOn ' ], [], '' , false );
89
+ $ this ->remoteAddress = $ this ->getMock ('Magento\Framework\HTTP\PhpEnvironment\RemoteAddress ' , [], [], '' , false );
85
90
$ filesystem = $ this ->getMock (\Magento \Framework \Filesystem::class, [], [], '' , false );
86
91
87
92
$ this ->logger = $ this ->getMock (\Psr \Log \LoggerInterface::class);
@@ -91,6 +96,7 @@ protected function setUp()
91
96
$ mapObjectManager = [
92
97
[\Magento \Framework \App \Filesystem \DirectoryList::class, $ this ->dirs ],
93
98
[\Magento \Framework \App \MaintenanceMode::class, $ this ->maintenanceMode ],
99
+ [\Magento \Framework \HTTP \PhpEnvironment \RemoteAddress::class, $ this ->remoteAddress ],
94
100
[\Magento \Framework \Filesystem::class, $ filesystem ],
95
101
[\Magento \Framework \App \DeploymentConfig::class, $ this ->deploymentConfig ],
96
102
['Psr\Log\LoggerInterface ' , $ this ->logger ],
@@ -205,7 +211,7 @@ public function testIsDeveloperModeDataProvider()
205
211
[State::MODE_DEVELOPER , State::MODE_PRODUCTION , true ],
206
212
[State::MODE_PRODUCTION , State::MODE_DEVELOPER , false ],
207
213
[null , State::MODE_DEVELOPER , true ],
208
- [null , State::MODE_PRODUCTION , false ]
214
+ [null , State::MODE_PRODUCTION , false ],
209
215
];
210
216
}
211
217
@@ -260,6 +266,7 @@ public function testAssertMaintenance($isOn, $isExpected)
260
266
{
261
267
$ bootstrap = self ::createBootstrap ([Bootstrap::PARAM_REQUIRE_MAINTENANCE => $ isExpected ]);
262
268
$ this ->maintenanceMode ->expects ($ this ->once ())->method ('isOn ' )->willReturn ($ isOn );
269
+ $ this ->remoteAddress ->expects ($ this ->once ())->method ('getRemoteAddress ' )->willReturn (false );
263
270
$ this ->application ->expects ($ this ->never ())->method ('launch ' );
264
271
$ this ->application ->expects ($ this ->once ())->method ('catchException ' )->willReturn (true );
265
272
$ bootstrap ->run ($ this ->application );
@@ -273,7 +280,7 @@ public function assertMaintenanceDataProvider()
273
280
{
274
281
return [
275
282
[true , false ],
276
- [false , true ]
283
+ [false , true ],
277
284
];
278
285
}
279
286
0 commit comments