Skip to content

Commit

Permalink
Make it easier to detect we are running tests under a PEAR install so…
Browse files Browse the repository at this point in the history
… the executable file check can be ignored
  • Loading branch information
gsherwood committed Dec 4, 2019
1 parent b3c7925 commit 68048f3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/Standards/Generic/Tests/Files/ExecutableFileUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,20 @@ class ExecutableFileUnitTest extends AbstractSniffUnitTest
{


/**
* Should this test be skipped for some reason.
*
* @return void
*/
protected function shouldSkipTest()
{
// PEAR doesn't preserve the executable flag, so skip
// tests when running in a PEAR install.
return $GLOBALS['PHP_CODESNIFFER_PEAR'];

}//end shouldSkipTest()


/**
* Returns the lines where errors should occur.
*
Expand Down
3 changes: 3 additions & 0 deletions tests/AllTests.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@

namespace PHP_CodeSniffer\Tests;

$GLOBALS['PHP_CODESNIFFER_PEAR'] = false;

if (is_file(__DIR__.'/../autoload.php') === true) {
include_once 'Core/AllTests.php';
include_once 'Standards/AllSniffs.php';
} else {
include_once 'CodeSniffer/Core/AllTests.php';
include_once 'CodeSniffer/Standards/AllSniffs.php';
include_once 'FileList.php';
$GLOBALS['PHP_CODESNIFFER_PEAR'] = true;
}

// PHPUnit 7 made the TestSuite run() method incompatible with
Expand Down

0 comments on commit 68048f3

Please sign in to comment.