Skip to content

Commit 68048f3

Browse files
committed
Make it easier to detect we are running tests under a PEAR install so the executable file check can be ignored
1 parent b3c7925 commit 68048f3

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/Standards/Generic/Tests/Files/ExecutableFileUnitTest.php

+14
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,20 @@ class ExecutableFileUnitTest extends AbstractSniffUnitTest
1515
{
1616

1717

18+
/**
19+
* Should this test be skipped for some reason.
20+
*
21+
* @return void
22+
*/
23+
protected function shouldSkipTest()
24+
{
25+
// PEAR doesn't preserve the executable flag, so skip
26+
// tests when running in a PEAR install.
27+
return $GLOBALS['PHP_CODESNIFFER_PEAR'];
28+
29+
}//end shouldSkipTest()
30+
31+
1832
/**
1933
* Returns the lines where errors should occur.
2034
*

tests/AllTests.php

+3
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,16 @@
99

1010
namespace PHP_CodeSniffer\Tests;
1111

12+
$GLOBALS['PHP_CODESNIFFER_PEAR'] = false;
13+
1214
if (is_file(__DIR__.'/../autoload.php') === true) {
1315
include_once 'Core/AllTests.php';
1416
include_once 'Standards/AllSniffs.php';
1517
} else {
1618
include_once 'CodeSniffer/Core/AllTests.php';
1719
include_once 'CodeSniffer/Standards/AllSniffs.php';
1820
include_once 'FileList.php';
21+
$GLOBALS['PHP_CODESNIFFER_PEAR'] = true;
1922
}
2023

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

0 commit comments

Comments
 (0)