Skip to content

Commit

Permalink
chore: remove error handler hack (#729)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikophil authored Dec 12, 2024
1 parent a7bbf32 commit 138801d
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 59 deletions.
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"symfony/dotenv": "^6.4|^7.0",
"symfony/maker-bundle": "^1.55",
"symfony/phpunit-bridge": "^6.4|^7.0",
"symfony/runtime": "^6.4|^7.0",
"symfony/translation-contracts": "^3.4",
"symfony/var-dumper": "^6.4|^7.0",
"symfony/yaml": "^6.4|^7.0"
Expand All @@ -52,7 +53,6 @@
"files": [
"src/functions.php",
"src/Persistence/functions.php",
"src/phpunit_helper.php",
"src/symfony_console.php"
]
},
Expand All @@ -68,7 +68,8 @@
"sort-packages": true,
"allow-plugins": {
"bamarni/composer-bin-plugin": true,
"symfony/flex": true
"symfony/flex": true,
"symfony/runtime": false
}
},
"extra": {
Expand Down
7 changes: 1 addition & 6 deletions src/Test/ResetDatabase.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Zenstruck\Foundry\Persistence\ResetDatabase\ResetDatabaseManager;

use function Zenstruck\Foundry\restorePhpUnitErrorHandler;

/**
* @author Kevin Bond <kevinbond@gmail.com>
*/
Expand All @@ -36,10 +34,7 @@ public static function _resetDatabaseBeforeFirstTest(): void

ResetDatabaseManager::resetBeforeFirstTest(
static fn() => static::bootKernel(),
static function(): void {
static::ensureKernelShutdown();
restorePhpUnitErrorHandler();
},
static fn() => static::ensureKernelShutdown(),
);
}

Expand Down
42 changes: 0 additions & 42 deletions src/phpunit_helper.php

This file was deleted.

3 changes: 0 additions & 3 deletions tests/bootstrap-migrate.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
*/

use Symfony\Component\Dotenv\Dotenv;
use Symfony\Component\ErrorHandler\ErrorHandler;
use Symfony\Component\Filesystem\Filesystem;
use Zenstruck\Foundry\Tests\Fixture\MigrationTests\TestMigrationKernel;

Expand Down Expand Up @@ -44,5 +43,3 @@
runCommand($application, 'doctrine:database:drop --force', canFail: true);

$kernel->shutdown();

\set_exception_handler([new ErrorHandler(), 'handleException']);
9 changes: 3 additions & 6 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,12 @@
*/

use Symfony\Component\Dotenv\Dotenv;
use Symfony\Component\ErrorHandler\ErrorHandler;
use Symfony\Component\Filesystem\Filesystem;

require \dirname(__DIR__).'/vendor/autoload.php';
require \dirname(__DIR__) . '/vendor/autoload.php';

$fs = new Filesystem();

$fs->remove(__DIR__.'/../var');
$fs->remove(__DIR__ . '/../var');

(new Dotenv())->usePutenv()->loadEnv(__DIR__.'/../.env');

\set_exception_handler([new ErrorHandler(), 'handleException']);
(new Dotenv())->usePutenv()->loadEnv(__DIR__ . '/../.env');

0 comments on commit 138801d

Please sign in to comment.