Skip to content

Commit f487c44

Browse files
authored
test: anonymous bundle class breaks twig extension (#6566)
1 parent 21ad3db commit f487c44

File tree

2 files changed

+26
-7
lines changed

2 files changed

+26
-7
lines changed

tests/Fixtures/app/AppKernel.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use ApiPlatform\Tests\Fixtures\TestBundle\Document\User as UserDocument;
1717
use ApiPlatform\Tests\Fixtures\TestBundle\Entity\User;
1818
use ApiPlatform\Tests\Fixtures\TestBundle\TestBundle;
19+
use ApiPlatform\Tests\PhpUnitBundle;
1920
use Doctrine\Bundle\DoctrineBundle\ConnectionFactory;
2021
use Doctrine\Bundle\DoctrineBundle\DoctrineBundle;
2122
use Doctrine\Bundle\MongoDBBundle\Command\TailCursorDoctrineODMCommand;
@@ -34,7 +35,6 @@
3435
use Symfony\Component\ErrorHandler\ErrorRenderer\ErrorRendererInterface;
3536
use Symfony\Component\HttpClient\Messenger\PingWebhookMessageHandler;
3637
use Symfony\Component\HttpFoundation\Session\SessionFactory;
37-
use Symfony\Component\HttpKernel\Bundle\Bundle;
3838
use Symfony\Component\HttpKernel\Kernel;
3939
use Symfony\Component\PasswordHasher\Hasher\NativePasswordHasher;
4040
use Symfony\Component\Security\Core\Authorization\Strategy\AccessDecisionStrategyInterface;
@@ -69,12 +69,7 @@ public function registerBundles(): array
6969
new WebProfilerBundle(),
7070
new FrameworkBundle(),
7171
new MakerBundle(),
72-
new class extends Bundle {
73-
public function shutdown(): void
74-
{
75-
restore_exception_handler();
76-
}
77-
},
72+
new PhpUnitBundle(),
7873
];
7974

8075
if (null === ($_ENV['APP_PHPUNIT'] ?? null)) {

tests/PhpUnitBundle.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the API Platform project.
5+
*
6+
* (c) Kévin Dunglas <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
declare(strict_types=1);
13+
14+
namespace ApiPlatform\Tests;
15+
16+
use Symfony\Component\HttpKernel\Bundle\Bundle;
17+
18+
final class PhpUnitBundle extends Bundle
19+
{
20+
public function shutdown(): void
21+
{
22+
restore_exception_handler();
23+
}
24+
}

0 commit comments

Comments
 (0)