File tree 2 files changed +13
-1
lines changed
2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change 4
4
*
5
5
* @package ThemeIsle
6
6
*/
7
- if ( defined ( 'PHPUNIT_COMPOSER_INSTALL ' ) ) {
7
+
8
+ // This condition tries to detect if we're running PHPUnit. This is complex because the file is loaded via the
9
+ // composer autoloader. You can detect that 99% of the time because PHPUnit uses the constant
10
+ // PHPUNIT_COMPOSER_INSTALL to load the autoloader. That said, if you run a test in a separate process, it won't
11
+ // run that code again and the constant doesn't exist. As a fallback, we use the PHPUNIT_RUNNING environment variable
12
+ // defined in the phpunit.xml to detect if we're in a PHPUnit process. We can't always use the environment variable
13
+ // because by default PHPUnit loads the composer autoloader before it assigns those environment variables. That's
14
+ // why both conditions are needed.
15
+ if ( defined ( 'PHPUNIT_COMPOSER_INSTALL ' ) || getenv ( 'PHPUNIT_RUNNING ' ) ) {
8
16
return ;
9
17
}
10
18
Original file line number Diff line number Diff line change 6
6
convertNoticesToExceptions =" true"
7
7
convertWarningsToExceptions =" true"
8
8
>
9
+ <php >
10
+ <env name =" PHPUNIT_RUNNING" value =" 1" />
11
+ </php >
12
+
9
13
<testsuites >
10
14
<testsuite name =" General Unit tests ( Requires PHP 5.4) " >
11
15
<directory phpVersion =" 5.4.0" phpVersionOperator =" >=" prefix =" test-" suffix =" .php" >./tests/</directory >
You can’t perform that action at this time.
0 commit comments