Skip to content

Commit 11cc87c

Browse files
committed
Fixed test issues
1 parent ed25c5b commit 11cc87c

10 files changed

Lines changed: 39 additions & 18 deletions

tests/Integration/AbstractITKDevEntityIntegrationTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,12 @@
99
use ITKDev\EntityBundle\Entity\Contract\IdentifiableInterface;
1010
use ITKDev\EntityBundle\Tests\Fixtures\Entity\FixtureEntity;
1111
use ITKDev\EntityBundle\Tests\Fixtures\Entity\TestUser;
12-
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
1312
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
1413
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
1514
use Symfony\Component\Security\Core\User\UserInterface;
1615
use Symfony\Component\Uid\Ulid;
1716

18-
final class AbstractITKDevEntityIntegrationTest extends KernelTestCase
17+
final class AbstractITKDevEntityIntegrationTest extends IntegrationTestCase
1918
{
2019
private EntityManagerInterface $em;
2120

tests/Integration/AuditLogIntegrationTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@
99
use Doctrine\ORM\Tools\SchemaTool;
1010
use ITKDev\EntityBundle\Tests\Fixtures\Entity\FixtureEntity;
1111
use ITKDev\EntityBundle\Tests\Fixtures\Entity\TestUser;
12-
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
1312
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
1413
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
1514

16-
final class AuditLogIntegrationTest extends KernelTestCase
15+
final class AuditLogIntegrationTest extends IntegrationTestCase
1716
{
1817
private EntityManagerInterface $em;
1918
private Reader $auditReader;
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace ITKDev\EntityBundle\Tests\Integration;
6+
7+
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
8+
9+
/**
10+
* Booting the Symfony kernel in the test env installs error/exception handlers
11+
* via Symfony\Component\ErrorHandler\ErrorHandler — these survive kernel
12+
* shutdown, which PHPUnit 13 flags as risky. Restore them in tearDown so the
13+
* handler stack is balanced.
14+
*/
15+
abstract class IntegrationTestCase extends KernelTestCase
16+
{
17+
protected function tearDown(): void
18+
{
19+
parent::tearDown();
20+
21+
restore_exception_handler();
22+
}
23+
}

tests/Integration/Privacy/AuditRetentionSweepTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
use ITKDev\EntityBundle\Privacy\BulkAnonymizer;
1111
use ITKDev\EntityBundle\Tests\Fixtures\Entity\FixtureEntity;
1212
use ITKDev\EntityBundle\Tests\Fixtures\Entity\TestUser;
13-
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
13+
use ITKDev\EntityBundle\Tests\Integration\IntegrationTestCase;
1414
use Symfony\Component\Clock\MockClock;
1515
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
1616
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
1717

18-
final class AuditRetentionSweepTest extends KernelTestCase
18+
final class AuditRetentionSweepTest extends IntegrationTestCase
1919
{
2020
private EntityManagerInterface $em;
2121
private Connection $conn;

tests/Integration/Privacy/AuditScrubberTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
use ITKDev\EntityBundle\Privacy\SubjectAnonymizer;
1212
use ITKDev\EntityBundle\Tests\Fixtures\Entity\FixtureEntity;
1313
use ITKDev\EntityBundle\Tests\Fixtures\Entity\TestUser;
14-
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
14+
use ITKDev\EntityBundle\Tests\Integration\IntegrationTestCase;
1515
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
1616
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
1717

18-
final class AuditScrubberTest extends KernelTestCase
18+
final class AuditScrubberTest extends IntegrationTestCase
1919
{
2020
private EntityManagerInterface $em;
2121
private Connection $conn;

tests/Integration/Privacy/BulkAnonymizerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
use Doctrine\ORM\Tools\SchemaTool;
99
use ITKDev\EntityBundle\Privacy\BulkAnonymizer;
1010
use ITKDev\EntityBundle\Tests\Fixtures\Entity\FixtureEntity;
11-
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
11+
use ITKDev\EntityBundle\Tests\Integration\IntegrationTestCase;
1212
use Symfony\Component\Clock\MockClock;
1313

14-
final class BulkAnonymizerTest extends KernelTestCase
14+
final class BulkAnonymizerTest extends IntegrationTestCase
1515
{
1616
private EntityManagerInterface $em;
1717
private BulkAnonymizer $anonymizer;

tests/Integration/Privacy/PrivacyAnonymizeCommandTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
use Doctrine\ORM\Tools\SchemaTool;
99
use ITKDev\EntityBundle\Tests\Fixtures\Entity\FixtureEntity;
1010
use ITKDev\EntityBundle\Tests\Fixtures\Entity\TestUser;
11+
use ITKDev\EntityBundle\Tests\Integration\IntegrationTestCase;
1112
use Symfony\Bundle\FrameworkBundle\Console\Application;
12-
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
1313
use Symfony\Component\Console\Command\Command;
1414
use Symfony\Component\Console\Tester\CommandTester;
1515
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
1616
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
1717

18-
final class PrivacyAnonymizeCommandTest extends KernelTestCase
18+
final class PrivacyAnonymizeCommandTest extends IntegrationTestCase
1919
{
2020
private EntityManagerInterface $em;
2121
private CommandTester $tester;

tests/Integration/Privacy/PrivacyAnonymizeStaleCommandTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
use Doctrine\ORM\EntityManagerInterface;
88
use Doctrine\ORM\Tools\SchemaTool;
99
use ITKDev\EntityBundle\Tests\Fixtures\Entity\FixtureEntity;
10+
use ITKDev\EntityBundle\Tests\Integration\IntegrationTestCase;
1011
use Symfony\Bundle\FrameworkBundle\Console\Application;
11-
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
1212
use Symfony\Component\Clock\MockClock;
1313
use Symfony\Component\Console\Command\Command;
1414
use Symfony\Component\Console\Tester\CommandTester;
1515

16-
final class PrivacyAnonymizeStaleCommandTest extends KernelTestCase
16+
final class PrivacyAnonymizeStaleCommandTest extends IntegrationTestCase
1717
{
1818
private EntityManagerInterface $em;
1919
private MockClock $clock;

tests/Integration/Privacy/StaleEntityFinderTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
use ITKDev\EntityBundle\Entity\Contract\IdentifiableInterface;
1010
use ITKDev\EntityBundle\Privacy\StaleEntityFinder;
1111
use ITKDev\EntityBundle\Tests\Fixtures\Entity\FixtureEntity;
12-
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
12+
use ITKDev\EntityBundle\Tests\Integration\IntegrationTestCase;
1313
use Symfony\Component\Clock\MockClock;
1414

15-
final class StaleEntityFinderTest extends KernelTestCase
15+
final class StaleEntityFinderTest extends IntegrationTestCase
1616
{
1717
private EntityManagerInterface $em;
1818
private StaleEntityFinder $finder;

tests/Integration/Privacy/SubjectAnonymizerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
use ITKDev\EntityBundle\Privacy\SubjectAnonymizer;
1010
use ITKDev\EntityBundle\Tests\Fixtures\Entity\FixtureEntity;
1111
use ITKDev\EntityBundle\Tests\Fixtures\Entity\TestUser;
12-
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
12+
use ITKDev\EntityBundle\Tests\Integration\IntegrationTestCase;
1313
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
1414
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
1515

16-
final class SubjectAnonymizerTest extends KernelTestCase
16+
final class SubjectAnonymizerTest extends IntegrationTestCase
1717
{
1818
private EntityManagerInterface $em;
1919
private SubjectAnonymizer $anonymizer;

0 commit comments

Comments
 (0)