Skip to content

Commit

Permalink
MAGETWO-81742: PHP Livecodetest testCodeStyle() method does not use w…
Browse files Browse the repository at this point in the history
…hitelist files #11376
  • Loading branch information
Stanislav Idolov authored Mar 10, 2018
2 parents ccad75e + b8309a2 commit 4597893
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions dev/tests/static/phpunit-all.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,7 @@
</testsuites>
<php>
<ini name="date.timezone" value="America/Los_Angeles"/>
<!-- TESTCODESTYLE_IS_FULL_SCAN - specify if full scan should be performed for test code style test -->
<const name="TESTCODESTYLE_IS_FULL_SCAN" value="1"/>
</php>
</phpunit>
2 changes: 2 additions & 0 deletions dev/tests/static/phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
</testsuites>
<php>
<ini name="date.timezone" value="America/Los_Angeles"/>
<!-- TESTCODESTYLE_IS_FULL_SCAN - specify if full scan should be performed for test code style test -->
<const name="TESTCODESTYLE_IS_FULL_SCAN" value="1"/>
<!-- TESTS_COMPOSER_PATH - specify the path to composer binary, if a relative reference cannot be resolved -->
<!--<const name="TESTS_COMPOSER_PATH" value="/usr/local/bin/composer"/>-->
</php>
Expand Down
5 changes: 4 additions & 1 deletion dev/tests/static/testsuite/Magento/Test/Php/LiveCodeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,11 +201,14 @@ private function getFullWhitelist()

public function testCodeStyle()
{
$whiteList = defined('TESTCODESTYLE_IS_FULL_SCAN') && TESTCODESTYLE_IS_FULL_SCAN === '1'
? $this->getFullWhitelist() : self::getWhitelist(['php', 'phtml']);

$reportFile = self::$reportDir . '/phpcs_report.txt';
$codeSniffer = new CodeSniffer('Magento', $reportFile, new Wrapper());
$this->assertEquals(
0,
$result = $codeSniffer->run($this->getFullWhitelist()),
$result = $codeSniffer->run($whiteList),
"PHP Code Sniffer detected {$result} violation(s): " . PHP_EOL . file_get_contents($reportFile)
);
}
Expand Down

0 comments on commit 4597893

Please sign in to comment.