Skip to content

Commit d046fa2

Browse files
mazhalaiOlga Kopylova
authored andcommitted
MAGETWO-44929: [PHP7] Unit tests PHPReadinessCheck and Maintenance fail on bamboo
- reverting debugging changes
1 parent 19f74ad commit d046fa2

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

setup/src/Magento/Setup/Controller/Maintenance.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,11 @@ public function __construct(MaintenanceMode $maintenanceMode)
3737
public function indexAction()
3838
{
3939
try {
40-
echo $this->getRequest()->getContent();
4140
$params = Json::decode($this->getRequest()->getContent(), Json::TYPE_ARRAY);
4241
$action = isset($params['disable']) && $params['disable'] ? false : true;
4342
$this->maintenanceMode->set($action);
4443
return new JsonModel(['responseType' => ResponseTypeInterface::RESPONSE_TYPE_SUCCESS]);
4544
} catch (\Exception $e) {
46-
var_dump($e);
4745
return new JsonModel(
4846
[
4947
'responseType' => ResponseTypeInterface::RESPONSE_TYPE_ERROR,

setup/src/Magento/Setup/Test/Unit/Controller/MaintenanceTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,21 @@ public function setUp()
2828
{
2929
$this->maintenanceMode = $this->getMock('Magento\Framework\App\MaintenanceMode', [], [], '', false);
3030
$this->controller = new Maintenance($this->maintenanceMode);
31+
32+
$request = $this->getMock('\Zend\Http\PhpEnvironment\Request', [], [], '', false);
33+
$response = $this->getMock('\Zend\Http\PhpEnvironment\Response', [], [], '', false);
34+
$routeMatch = $this->getMock('\Zend\Mvc\Router\RouteMatch', [], [], '', false);
35+
36+
$mvcEvent = $this->getMock('\Zend\Mvc\MvcEvent', [], [], '', false);
37+
$mvcEvent->expects($this->any())->method('setRequest')->with($request)->willReturn($mvcEvent);
38+
$mvcEvent->expects($this->any())->method('setResponse')->with($response)->willReturn($mvcEvent);
39+
$mvcEvent->expects($this->any())->method('setTarget')->with($this->controller)->willReturn($mvcEvent);
40+
$mvcEvent->expects($this->any())->method('getRouteMatch')->willReturn($routeMatch);
41+
$contentArray = '{"disable":false}';
42+
$request->expects($this->any())->method('getContent')->willReturn($contentArray);
43+
44+
$this->controller->setEvent($mvcEvent);
45+
$this->controller->dispatch($request, $response);
3146
}
3247

3348
public function testIndexAction()

0 commit comments

Comments
 (0)