diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fbef6d65106..f13687729ce 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -252,7 +252,7 @@ jobs: with: java-version: 1.8 - - name: Run regular unit tests with unscoped PHAR + - name: Run regular test suite with unscoped PHAR run: ant run-regular-tests-with-unscoped-phar - name: Run PHAR-specific end-to-end tests with scoped PHAR diff --git a/build.xml b/build.xml index 7a07d351d9b..db428a1f685 100644 --- a/build.xml +++ b/build.xml @@ -454,6 +454,7 @@ + diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 1316a2141ba..09e4fbed085 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -9,25 +9,32 @@ */ const TEST_FILES_PATH = __DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR; -if (file_exists(__DIR__ . '/../vendor/autoload.php') && file_exists(__DIR__ . '/autoload.php')) { - print 'More than one test fixture autoloader is available, exiting.' . \PHP_EOL; +$composer = file_exists(__DIR__ . '/../vendor/autoload.php'); +$phar = file_exists(__DIR__ . '/autoload.php'); + +if ($composer && $phar) { + print 'More than one test fixture autoloader is available, exiting.' . PHP_EOL; + + exit(1); +} + +if (!$composer && !$phar) { + print 'No test fixture autoloader was registered, exiting.' . PHP_EOL; exit(1); } -if (file_exists(__DIR__ . '/../vendor/autoload.php')) { +if ($composer) { if (!defined('PHPUNIT_COMPOSER_INSTALL')) { define('PHPUNIT_COMPOSER_INSTALL', dirname(__DIR__) . '/vendor/autoload.php'); } require_once __DIR__ . '/../vendor/autoload.php'; - - return; } -if (file_exists(__DIR__ . '/autoload.php')) { +if ($phar) { if (!defined('__PHPUNIT_PHAR__')) { - define('__PHPUNIT_PHAR__', realpath($_SERVER['_'])); + require_once __DIR__ . '/../build/artifacts/phpunit-snapshot.phar'; } require_once __DIR__ . '/autoload.php'; @@ -38,12 +45,6 @@ foreach (json_decode(file_get_contents($jsonFile), true)['autoload-dev']['files'] as $file) { require_once $base . DIRECTORY_SEPARATOR . $file; } - - unset($jsonFile, $base, $file); - - return; } -print 'No test fixture autoloader was registered, exiting.' . \PHP_EOL; - -exit(1); +unset($composer, $phar, $jsonFile, $base, $file); diff --git a/tests/end-to-end/regression/GitHub/1351.phpt b/tests/end-to-end/regression/GitHub/1351.phpt deleted file mode 100644 index b8cc78ab5b6..00000000000 --- a/tests/end-to-end/regression/GitHub/1351.phpt +++ /dev/null @@ -1,45 +0,0 @@ ---TEST-- -https://github.com/sebastianbergmann/phpunit/issues/1351 ---SKIPIF-- - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -class ChildProcessClass1351 -{ -} diff --git a/tests/end-to-end/regression/GitHub/1351/Issue1351Test.php b/tests/end-to-end/regression/GitHub/1351/Issue1351Test.php deleted file mode 100644 index f411aa1bac1..00000000000 --- a/tests/end-to-end/regression/GitHub/1351/Issue1351Test.php +++ /dev/null @@ -1,59 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -use PHPUnit\Framework\TestCase; - -class Issue1351Test extends TestCase -{ - protected $instance; - - /** - * @runInSeparateProcess - */ - public function testFailurePre(): void - { - $this->instance = new ChildProcessClass1351; - $this->assertFalse(true, 'Expected failure.'); - } - - public function testFailurePost(): void - { - $this->assertNull($this->instance); - $this->assertFalse(\class_exists(ChildProcessClass1351::class, false), 'ChildProcessClass1351 is not loaded.'); - } - - /** - * @runInSeparateProcess - */ - public function testExceptionPre(): void - { - $this->instance = new ChildProcessClass1351; - - try { - throw new LogicException('Expected exception.'); - } catch (LogicException $e) { - throw new RuntimeException('Expected rethrown exception.', 0, $e); - } - } - - public function testExceptionPost(): void - { - $this->assertNull($this->instance); - $this->assertFalse(\class_exists(ChildProcessClass1351::class, false), 'ChildProcessClass1351 is not loaded.'); - } - - public function testPhpCoreLanguageException(): void - { - // User-space code cannot instantiate a PDOException with a string code, - // so trigger a real one. - $connection = new PDO('sqlite::memory:'); - $connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - $connection->query("DELETE FROM php_wtf WHERE exception_code = 'STRING'"); - } -}