Skip to content

Commit d18a421

Browse files
author
Oleksii Korshenko
authored
MAGETWO-81646: PHP Livecodetest testCodeStyle() method does not use whitelist files #11362
2 parents 221e2a4 + bdcac88 commit d18a421

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

dev/tests/static/phpunit-all.xml.dist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,7 @@
2020
</testsuites>
2121
<php>
2222
<ini name="date.timezone" value="America/Los_Angeles"/>
23+
<!-- TESTCODESTYLE_IS_FULL_SCAN - specify if full scan should be performed for test code style test -->
24+
<const name="TESTCODESTYLE_IS_FULL_SCAN" value="1"/>
2325
</php>
2426
</phpunit>

dev/tests/static/phpunit.xml.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
</testsuites>
3131
<php>
3232
<ini name="date.timezone" value="America/Los_Angeles"/>
33+
<!-- TESTCODESTYLE_IS_FULL_SCAN - specify if full scan should be performed for test code style test -->
3334
<const name="TESTCODESTYLE_IS_FULL_SCAN" value="1"/>
3435
<!-- TESTS_COMPOSER_PATH - specify the path to composer binary, if a relative reference cannot be resolved -->
3536
<!--<const name="TESTS_COMPOSER_PATH" value="/usr/local/bin/composer"/>-->

dev/tests/static/testsuite/Magento/Test/Php/LiveCodeTest.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,13 +199,11 @@ private function getFullWhitelist()
199199

200200
public function testCodeStyle()
201201
{
202-
$whiteList = defined('TESTCODESTYLE_IS_FULL_SCAN') && TESTCODESTYLE_IS_FULL_SCAN === '1'
203-
? $this->getFullWhitelist() : self::getWhitelist(['php', 'phtml']);
204-
202+
$isFullScan = defined('TESTCODESTYLE_IS_FULL_SCAN') && TESTCODESTYLE_IS_FULL_SCAN === '1';
205203
$reportFile = self::$reportDir . '/phpcs_report.txt';
206204
$codeSniffer = new CodeSniffer('Magento', $reportFile, new Wrapper());
207-
$result = $codeSniffer->run($whiteList);
208-
$report = file_exists($reportFile) ? file_get_contents($reportFile) : '';
205+
$result = $codeSniffer->run($isFullScan ? $this->getFullWhitelist() : self::getWhitelist(['php', 'phtml']));
206+
$report = file_get_contents($reportFile);
209207
$this->assertEquals(
210208
0,
211209
$result,

0 commit comments

Comments
 (0)