Remove deprecation linked to kernel shutdown

This commit is contained in:
2023-08-31 18:36:37 +02:00
parent 7c58880139
commit 6f11dffcbd
23 changed files with 166 additions and 85 deletions

View File

@@ -26,13 +26,12 @@ final class AddressControllerTest extends \Symfony\Bundle\FrameworkBundle\Test\W
private KernelBrowser $client;
protected function setUp(): void
protected function tearDown(): void
{
self::bootKernel();
$this->client = $this->getClientAuthenticated();
self::ensureKernelShutdown();
}
public function generateAddressIds()
public function generateAddressIds(): iterable
{
self::bootKernel();
$em = self::$container->get(EntityManagerInterface::class);
@@ -46,6 +45,8 @@ final class AddressControllerTest extends \Symfony\Bundle\FrameworkBundle\Test\W
foreach ($addresses as $a) {
yield [$a->getId()];
}
self::ensureKernelShutdown();
}
/**
@@ -53,6 +54,7 @@ final class AddressControllerTest extends \Symfony\Bundle\FrameworkBundle\Test\W
*/
public function testDuplicate(int $addressId)
{
$this->client = $this->getClientAuthenticated();
$this->client->request('POST', "/api/1.0/main/address/{$addressId}/duplicate.json");
$this->assertResponseIsSuccessful('test that duplicate is successful');

View File

@@ -31,10 +31,14 @@ class AddressToReferenceMatcherControllerTest extends WebTestCase
protected function setUp(): void
{
self::bootKernel();
$this->addressRepository = self::$container->get(AddressRepository::class);
}
protected function tearDown(): void
{
self::ensureKernelShutdown();
}
/**
* @dataProvider addressToReviewProvider
*/
@@ -92,6 +96,8 @@ class AddressToReferenceMatcherControllerTest extends WebTestCase
$em->flush();
yield [$address->getId()];
self::ensureKernelShutdown();
}
public static function addressUnsyncedProvider(): iterable
@@ -123,5 +129,7 @@ class AddressToReferenceMatcherControllerTest extends WebTestCase
$em->flush();
yield [$address->getId()];
self::ensureKernelShutdown();
}
}

View File

@@ -23,8 +23,15 @@ final class PermissionApiControllerTest extends WebTestCase
{
use PrepareClientTrait;
protected function tearDown(): void
{
self::ensureKernelShutdown();
}
public function testDenormalizingObject()
{
// for a unknown reason, the kernel may be booted before running this test...
self::ensureKernelShutdown();
$client = $this->getClientAuthenticated();
$client->request(

View File

@@ -29,8 +29,6 @@ final class UserControllerTest extends WebTestCase
protected function setUp(): void
{
self::bootKernel();
$this->client = self::createClient([], [
'PHP_AUTH_USER' => 'admin',
'PHP_AUTH_PW' => 'password',
@@ -49,6 +47,7 @@ final class UserControllerTest extends WebTestCase
}
$em->flush();
self::ensureKernelShutdown();
}
public function dataGenerateUserId()
@@ -69,6 +68,8 @@ final class UserControllerTest extends WebTestCase
$this->toDelete[] = [User::class, $user->getId()];
yield [$user->getId(), $user->getUsername()];
self::ensureKernelShutdown();
}
public function testList()

View File

@@ -34,9 +34,8 @@ final class DefaultScopeResolverTest extends TestCase
{
$scope = new Scope();
$entity = new class ($scope) implements HasScopeInterface {
public function __construct(Scope $scope)
public function __construct(private readonly Scope $scope)
{
$this->scope = $scope;
}
public function getScope()
@@ -53,9 +52,8 @@ final class DefaultScopeResolverTest extends TestCase
public function testHasScopesInterface()
{
$entity = new class ($scopeA = new Scope(), $scopeB = new Scope()) implements HasScopesInterface {
public function __construct(Scope $scopeA, Scope $scopeB)
public function __construct(private Scope $scopeA, private Scope $scopeB)
{
$this->scopes = [$scopeA, $scopeB];
}
public function getScopes(): iterable

View File

@@ -35,9 +35,8 @@ final class ScopeResolverDispatcherTest extends TestCase
{
$scope = new Scope();
$entity = new class ($scope) implements HasScopeInterface {
public function __construct(Scope $scope)
public function __construct(private readonly Scope $scope)
{
$this->scope = $scope;
}
public function getScope()
@@ -53,6 +52,10 @@ final class ScopeResolverDispatcherTest extends TestCase
public function testHasScopesInterface()
{
$entity = new class ($scopeA = new Scope(), $scopeB = new Scope()) implements HasScopesInterface {
/**
* @var Scope[]
*/
private array $scopes = [];
public function __construct(Scope $scopeA, Scope $scopeB)
{
$this->scopes = [$scopeA, $scopeB];