Skip to content

Commit ce29154

Browse files
committed
Fixed coding standard violations in the Framework\App namespace, so that it will be checked bij PHP CS and no longer be ignored while doing CI checks. Made the following changes:
- Removed @codingStandardsIgnoreFile from the head of the file - Move ActionFake to it's own file, because PSR-2 dicates only one class per file. - Fixed indentation - Fixed number of chars per line
1 parent c3040d3 commit ce29154

File tree

12 files changed

+76
-64
lines changed

12 files changed

+76
-64
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Framework\App\Test\Unit\Action;
8+
9+
use \Magento\Framework\App\Action\Action;
10+
11+
class ActionFake extends Action
12+
{
13+
/**
14+
* Fake action to check a method call from a parent
15+
*/
16+
public function execute()
17+
{
18+
$this->_forward(
19+
ActionTest::ACTION_NAME,
20+
ActionTest::CONTROLLER_NAME,
21+
ActionTest::MODULE_NAME,
22+
ActionTest::$actionParams
23+
);
24+
$this->_redirect(ActionTest::FULL_ACTION_NAME, ActionTest::$actionParams);
25+
return;
26+
}
27+
}

lib/internal/Magento/Framework/App/Test/Unit/Action/ActionTest.php

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
// @codingStandardsIgnoreFile
8-
97
namespace Magento\Framework\App\Test\Unit\Action;
108

119
use \Magento\Framework\App\Action\Action;
@@ -185,20 +183,3 @@ public function testDispatchPostDispatch()
185183
$this->assertEquals($this->_responseMock, $this->action->dispatch($this->_requestMock));
186184
}
187185
}
188-
189-
class ActionFake extends Action
190-
{
191-
/**
192-
* Fake action to check a method call from a parent
193-
*/
194-
public function execute()
195-
{
196-
$this->_forward(
197-
ActionTest::ACTION_NAME,
198-
ActionTest::CONTROLLER_NAME,
199-
ActionTest::MODULE_NAME,
200-
ActionTest::$actionParams);
201-
$this->_redirect(ActionTest::FULL_ACTION_NAME, ActionTest::$actionParams);
202-
return;
203-
}
204-
}

lib/internal/Magento/Framework/App/Test/Unit/AreaListTest.php

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
// @codingStandardsIgnoreFile
8-
97
namespace Magento\Framework\App\Test\Unit;
108

119
use \Magento\Framework\App\AreaList;
@@ -48,12 +46,12 @@ public function testGetCodeByFrontNameWhenAreaDoesNotContainFrontName()
4846
$this->_resolverFactory->expects(
4947
$this->any()
5048
)->method(
51-
'create'
52-
)->with(
53-
'testValue'
54-
)->will(
55-
$this->returnValue($resolverMock)
56-
);
49+
'create'
50+
)->with(
51+
'testValue'
52+
)->will(
53+
$this->returnValue($resolverMock)
54+
);
5755

5856
$actual = $this->_model->getCodeByFrontName('testFrontName');
5957
$this->assertEquals($expected, $actual);
@@ -106,7 +104,10 @@ public function testGetCodes()
106104
{
107105
$areas = ['area1' => 'value1', 'area2' => 'value2'];
108106
$this->_model = new \Magento\Framework\App\AreaList(
109-
$this->objectManagerMock, $this->_resolverFactory, $areas, ''
107+
$this->objectManagerMock,
108+
$this->_resolverFactory,
109+
$areas,
110+
''
110111
);
111112

112113
$expected = array_keys($areas);
@@ -118,7 +119,10 @@ public function testGetDefaultRouter()
118119
{
119120
$areas = ['area1' => ['router' => 'value1'], 'area2' => 'value2'];
120121
$this->_model = new \Magento\Framework\App\AreaList(
121-
$this->objectManagerMock, $this->_resolverFactory, $areas, ''
122+
$this->objectManagerMock,
123+
$this->_resolverFactory,
124+
$areas,
125+
''
122126
);
123127

124128
$this->assertEquals($this->_model->getDefaultRouter('area1'), $areas['area1']['router']);
@@ -131,7 +135,10 @@ public function testGetArea()
131135
$objectManagerMock = $this->getObjectManagerMockGetArea();
132136
$areas = ['area1' => ['router' => 'value1'], 'area2' => 'value2'];
133137
$this->_model = new AreaList(
134-
$objectManagerMock, $this->_resolverFactory, $areas, ''
138+
$objectManagerMock,
139+
$this->_resolverFactory,
140+
$areas,
141+
''
135142
);
136143

137144
$this->assertEquals($this->_model->getArea('testArea'), 'ok');

lib/internal/Magento/Framework/App/Test/Unit/BootstrapTest.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
// @codingStandardsIgnoreFile
8-
97
namespace Magento\Framework\App\Test\Unit;
108

119
use Magento\Framework\App\Bootstrap;
@@ -99,7 +97,7 @@ protected function setUp()
9997
[\Magento\Framework\HTTP\PhpEnvironment\RemoteAddress::class, $this->remoteAddress],
10098
[\Magento\Framework\Filesystem::class, $filesystem],
10199
[\Magento\Framework\App\DeploymentConfig::class, $this->deploymentConfig],
102-
['Psr\Log\LoggerInterface', $this->logger],
100+
[\Psr\Log\LoggerInterface::class, $this->logger],
103101
];
104102

105103
$this->objectManager->expects($this->any())->method('get')
@@ -211,7 +209,7 @@ public function testIsDeveloperModeDataProvider()
211209
[State::MODE_DEVELOPER, State::MODE_PRODUCTION, true],
212210
[State::MODE_PRODUCTION, State::MODE_DEVELOPER, false],
213211
[null, State::MODE_DEVELOPER, true],
214-
[null, State::MODE_PRODUCTION, false],
212+
[null, State::MODE_PRODUCTION, false]
215213
];
216214
}
217215

@@ -280,7 +278,7 @@ public function assertMaintenanceDataProvider()
280278
{
281279
return [
282280
[true, false],
283-
[false, true],
281+
[false, true]
284282
];
285283
}
286284

lib/internal/Magento/Framework/App/Test/Unit/ObjectManager/ConfigLoaderTest.php

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
// @codingStandardsIgnoreFile
8-
97
namespace Magento\Framework\App\Test\Unit\ObjectManager;
108

119
use Magento\Framework\Serialize\SerializerInterface;
@@ -55,15 +53,18 @@ protected function setUp()
5553
false
5654
);
5755

58-
$this->readerFactoryMock->expects(
59-
$this->any()
60-
)->method(
61-
'create'
62-
)->will(
63-
$this->returnValue($this->readerMock)
56+
$this->readerFactoryMock->expects($this->any())
57+
->method('create')
58+
->will($this->returnValue($this->readerMock));
59+
60+
$this->cacheMock = $this->getMock(
61+
\Magento\Framework\App\Cache\Type\Config::class,
62+
[],
63+
[],
64+
'',
65+
false
6466
);
6567

66-
$this->cacheMock = $this->getMock(\Magento\Framework\App\Cache\Type\Config::class, [], [], '', false);
6768
$objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
6869

6970
$this->object = $objectManagerHelper->getObject(
@@ -98,7 +99,10 @@ public function testLoadNotCached($area)
9899
$this->cacheMock->expects($this->once())
99100
->method('save')
100101
->with($serializedData);
101-
$this->readerMock->expects($this->once())->method('read')->with($area)->will($this->returnValue($configData));
102+
$this->readerMock->expects($this->once())
103+
->method('read')
104+
->with($area)
105+
->will($this->returnValue($configData));
102106

103107
$this->serializerMock->expects($this->once())
104108
->method('serialize')

lib/internal/Magento/Framework/App/Test/Unit/Request/HttpTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
* See COPYING.txt for license details.
66
*/
77

8-
// @codingStandardsIgnoreFile
9-
108
namespace Magento\Framework\App\Test\Unit\Request;
119

1210
use Magento\Framework\App\Config\ScopeConfigInterface;
@@ -345,8 +343,10 @@ public function testIsSecure($isSecure, $serverHttps, $headerOffloadKey, $header
345343
->getMock();
346344
$configMock->expects($this->exactly($configCall))
347345
->method('getValue')
348-
->with(\Magento\Framework\App\Request\Http::XML_PATH_OFFLOADER_HEADER, ScopeConfigInterface::SCOPE_TYPE_DEFAULT)
349-
->willReturn($configOffloadHeader);
346+
->with(
347+
\Magento\Framework\App\Request\Http::XML_PATH_OFFLOADER_HEADER,
348+
ScopeConfigInterface::SCOPE_TYPE_DEFAULT
349+
)->willReturn($configOffloadHeader);
350350

351351
$this->objectManager->setBackwardCompatibleProperty($this->_model, 'appConfig', $configMock);
352352
$this->objectManager->setBackwardCompatibleProperty($this->_model, 'sslOffloadHeader', null);

lib/internal/Magento/Framework/App/Test/Unit/Response/HttpTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
// @codingStandardsIgnoreFile
8-
97
namespace Magento\Framework\App\Test\Unit\Response;
108

119
use \Magento\Framework\App\Response\Http;
@@ -53,7 +51,8 @@ protected function setUp()
5351
)->disableOriginalConstructor()->getMock();
5452
$this->cookieManagerMock = $this->getMock(\Magento\Framework\Stdlib\CookieManagerInterface::class);
5553
$this->contextMock = $this->getMockBuilder(
56-
\Magento\Framework\App\Http\Context::class)->disableOriginalConstructor()
54+
\Magento\Framework\App\Http\Context::class
55+
)->disableOriginalConstructor()
5756
->getMock();
5857

5958
$this->dateTimeMock = $this->getMockBuilder(\Magento\Framework\Stdlib\DateTime::class)
@@ -87,7 +86,8 @@ public function testSendVary()
8786
$expectedCookieName = Http::COOKIE_VARY_STRING;
8887
$expectedCookieValue = 'SHA1 Serialized String';
8988
$sensitiveCookieMetadataMock = $this->getMockBuilder(
90-
\Magento\Framework\Stdlib\Cookie\SensitiveCookieMetadata::class)
89+
\Magento\Framework\Stdlib\Cookie\SensitiveCookieMetadata::class
90+
)
9191
->disableOriginalConstructor()
9292
->getMock();
9393
$sensitiveCookieMetadataMock->expects($this->once())

lib/internal/Magento/Framework/App/Test/Unit/Router/NoRouteHandlerListTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
// @codingStandardsIgnoreFile
8-
97
namespace Magento\Framework\App\Test\Unit\Router;
108

119
class NoRouteHandlerListTest extends \PHPUnit_Framework_TestCase

lib/internal/Magento/Framework/App/Test/Unit/Router/NoRouteHandlerTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
* See COPYING.txt for license details.
77
*/
88

9-
// @codingStandardsIgnoreFile
10-
119
namespace Magento\Framework\App\Test\Unit\Router;
1210

1311
class NoRouteHandlerTest extends \Magento\Framework\TestFramework\Unit\BaseTestCase

lib/internal/Magento/Framework/App/Test/Unit/StateTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
* See COPYING.txt for license details.
55
*/
66

7-
// @codingStandardsIgnoreFile
8-
97
namespace Magento\Framework\App\Test\Unit;
108

119
use \Magento\Framework\App\Area;

0 commit comments

Comments
 (0)