diff --git a/composer.json b/composer.json index 320e51ca25..ce1b38c5d0 100644 --- a/composer.json +++ b/composer.json @@ -77,8 +77,8 @@ "ibexa/code-style": "^1.3.x-dev", "ibexa/notifications": "~4.6.0@dev", "ibexa/phpstan": "~4.6.x-dev", - "ibexa/test-rest": "^0.1.x-dev", - "ibexa/test-core": "^0.1.x-dev", + "ibexa/test-rest": "~4.6.x-dev", + "ibexa/test-core": "~4.6.x-dev", "phpstan/phpstan": "^2.0", "phpstan/phpstan-phpunit": "^2.0", "phpstan/phpstan-symfony": "^2.0" diff --git a/tests/integration/AdminUiIbexaTestKernel.php b/tests/integration/AdminUiIbexaTestKernel.php index 6b4c8afa37..2a32e2a3ea 100644 --- a/tests/integration/AdminUiIbexaTestKernel.php +++ b/tests/integration/AdminUiIbexaTestKernel.php @@ -17,6 +17,7 @@ use Ibexa\Bundle\Notifications\IbexaNotificationsBundle; use Ibexa\Bundle\Rest\IbexaRestBundle; use Ibexa\Bundle\Search\IbexaSearchBundle; +use Ibexa\Bundle\Test\Core\IbexaTestCoreBundle; use Ibexa\Bundle\Test\Rest\IbexaTestRestBundle; use Ibexa\Bundle\TwigComponents\IbexaTwigComponentsBundle; use Ibexa\Bundle\User\IbexaUserBundle; @@ -43,6 +44,9 @@ public function registerBundles(): iterable { yield from parent::registerBundles(); + // required by Bootstrapper: provides HooksExecutorInterface and the built-in hooks + yield new IbexaTestCoreBundle(); + yield new HautelookTemplatedUriBundle(); yield new KnpMenuBundle(); yield new WebpackEncoreBundle(); diff --git a/tests/integration/bootstrap.php b/tests/integration/bootstrap.php index fa6083c9d0..48b6f8c444 100644 --- a/tests/integration/bootstrap.php +++ b/tests/integration/bootstrap.php @@ -6,48 +6,17 @@ */ declare(strict_types=1); -use Ibexa\Contracts\Core\Test\Persistence\Fixture\FixtureImporter; -use Ibexa\Tests\Core\Repository\LegacySchemaImporter; -use Ibexa\Tests\Integration\AdminUi\AdminUiIbexaTestKernel; -use Symfony\Bundle\FrameworkBundle\Console\Application; -use Symfony\Component\Console\Input\ArrayInput; +use Ibexa\Contracts\Test\Core\Bootstrapper\Bootstrapper; $packageRoot = dirname(__DIR__, 2); require_once $packageRoot . '/vendor/autoload.php'; chdir($packageRoot); -$kernel = new AdminUiIbexaTestKernel('test', true); -$kernel->boot(); - -$application = new Application($kernel); -$application->setAutoExit(false); - -$databaseUrl = getenv('DATABASE_URL'); -if ($databaseUrl !== false && 'sqlite' !== substr($databaseUrl, 0, 6)) { - $application->run(new ArrayInput([ - 'command' => 'doctrine:database:drop', - '--if-exists' => '1', - '--force' => '1', - '--quiet' => true, - ])); -} - -$application->run(new ArrayInput([ - 'command' => 'doctrine:database:create', - '--quiet' => true, -])); - -/** @var \Psr\Container\ContainerInterface $testContainer */ -$testContainer = $kernel->getContainer()->get('test.service_container'); - -$schemaImporter = $testContainer->get(LegacySchemaImporter::class); -foreach ($kernel->getSchemaFiles() as $file) { - $schemaImporter->importSchema($file); -} - -$fixtureImporter = $testContainer->get(FixtureImporter::class); -foreach ($kernel->getFixtures() as $fixture) { - $fixtureImporter->import($fixture); -} -$kernel->shutdown(); +(new Bootstrapper())->bootstrap(null, [ + Bootstrapper::class => [ + // this package's tests never ran doctrine:schema:update, and Bootstrapper enables it by + // default; keep it off so the bootstrap stays equivalent + Bootstrapper::OPTION_SCHEMA_UPDATE => false, + ], +]);