feat: upgrade phpunit to 12.5

This commit is contained in:
Björn Fromme
2026-08-31 09:31:00 +02:00
parent 010cfe56b2
commit bfad61f1dd
95 changed files with 1436 additions and 1224 deletions
+40 -16
View File
@@ -23,15 +23,18 @@ class ParticipantDataPrefillerTest extends TestCase
private ApiClient $apiClient;
private Crypt $crypt;
private LoggerInterface $logger;
private ParticipantDataPrefiller $service;
private ?ParticipantDataPrefiller $service = null;
protected function setUp(): void
{
$this->apiClient = $this->createMock(ApiClient::class);
$this->crypt = $this->createMock(Crypt::class);
$this->logger = $this->createMock(LoggerInterface::class);
$this->apiClient = $this->createStub(ApiClient::class);
$this->crypt = $this->createStub(Crypt::class);
$this->logger = $this->createStub(LoggerInterface::class);
}
$this->service = new ParticipantDataPrefiller(
private function service(): ParticipantDataPrefiller
{
return $this->service ??= new ParticipantDataPrefiller(
$this->apiClient,
$this->crypt,
$this->logger
@@ -40,6 +43,9 @@ class ParticipantDataPrefillerTest extends TestCase
public function testPrepopulateApplicantWithCompletePersonalData(): void
{
$this->apiClient = $this->createMock(ApiClient::class);
$this->crypt = $this->createMock(Crypt::class);
$user = $this->createUser('[email protected]', 'encrypted_password');
$applicant = new ParticipantDto();
$applicant->index = 0;
@@ -56,7 +62,7 @@ class ParticipantDataPrefillerTest extends TestCase
->with('[email protected]', 'decrypted_password')
->willReturn($personalData);
$result = $this->service->prefillApplicantFromUser($user, $applicant);
$result = $this->service()->prefillApplicantFromUser($user, $applicant);
// BPN API IDs for linking to existing records
$this->assertSame(12345, $result->addressId);
@@ -88,6 +94,9 @@ class ParticipantDataPrefillerTest extends TestCase
public function testPrepopulateApplicantWithPartialPersonalData(): void
{
$this->apiClient = $this->createMock(ApiClient::class);
$this->crypt = $this->createMock(Crypt::class);
$user = $this->createUser('[email protected]', 'encrypted_password');
$applicant = new ParticipantDto();
$applicant->index = 0;
@@ -102,7 +111,7 @@ class ParticipantDataPrefillerTest extends TestCase
->method('getPersonalData')
->willReturn($personalData);
$result = $this->service->prefillApplicantFromUser($user, $applicant);
$result = $this->service()->prefillApplicantFromUser($user, $applicant);
// Required fields should be populated
$this->assertSame('Jane', $result->firstName);
@@ -123,6 +132,10 @@ class ParticipantDataPrefillerTest extends TestCase
public function testPrepopulateApplicantWithApiNotificationError(): void
{
$this->apiClient = $this->createMock(ApiClient::class);
$this->crypt = $this->createMock(Crypt::class);
$this->logger = $this->createMock(LoggerInterface::class);
$user = $this->createUser('[email protected]', 'encrypted_password');
$applicant = new ParticipantDto();
$applicant->index = 0;
@@ -148,7 +161,7 @@ class ParticipantDataPrefillerTest extends TestCase
$this->logger->expects($this->never())
->method('info');
$result = $this->service->prefillApplicantFromUser($user, $applicant);
$result = $this->service()->prefillApplicantFromUser($user, $applicant);
// Should return unchanged applicant
$this->assertNull($result->firstName);
@@ -158,6 +171,10 @@ class ParticipantDataPrefillerTest extends TestCase
public function testPrepopulateApplicantWithDecryptionException(): void
{
$this->apiClient = $this->createMock(ApiClient::class);
$this->crypt = $this->createMock(Crypt::class);
$this->logger = $this->createMock(LoggerInterface::class);
$user = $this->createUser('[email protected]', 'encrypted_password');
$applicant = new ParticipantDto();
$applicant->index = 0;
@@ -176,7 +193,7 @@ class ParticipantDataPrefillerTest extends TestCase
'email' => '[email protected]',
]);
$result = $this->service->prefillApplicantFromUser($user, $applicant);
$result = $this->service()->prefillApplicantFromUser($user, $applicant);
// Should return unchanged applicant
$this->assertNull($result->firstName);
@@ -186,6 +203,10 @@ class ParticipantDataPrefillerTest extends TestCase
public function testPrepopulateApplicantWithApiException(): void
{
$this->apiClient = $this->createMock(ApiClient::class);
$this->crypt = $this->createMock(Crypt::class);
$this->logger = $this->createMock(LoggerInterface::class);
$user = $this->createUser('[email protected]', 'encrypted_password');
$applicant = new ParticipantDto();
$applicant->index = 0;
@@ -205,7 +226,7 @@ class ParticipantDataPrefillerTest extends TestCase
'email' => '[email protected]',
]);
$result = $this->service->prefillApplicantFromUser($user, $applicant);
$result = $this->service()->prefillApplicantFromUser($user, $applicant);
// Should return unchanged applicant
$this->assertNull($result->firstName);
@@ -215,6 +236,9 @@ class ParticipantDataPrefillerTest extends TestCase
public function testPrepopulatePreservesBookingSpecificFields(): void
{
$this->apiClient = $this->createMock(ApiClient::class);
$this->crypt = $this->createMock(Crypt::class);
$user = $this->createUser('[email protected]', 'encrypted_password');
$applicant = new ParticipantDto();
$applicant->index = 0;
@@ -231,7 +255,7 @@ class ParticipantDataPrefillerTest extends TestCase
->method('getPersonalData')
->willReturn($personalData);
$result = $this->service->prefillApplicantFromUser($user, $applicant);
$result = $this->service()->prefillApplicantFromUser($user, $applicant);
// Personal data should be updated
$this->assertSame('John', $result->firstName);
@@ -250,8 +274,8 @@ class ParticipantDataPrefillerTest extends TestCase
$filled = new ParticipantDto();
$filled->firstName = 'Already set';
$this->assertTrue($this->service->shouldPrefillApplicant($fresh));
$this->assertFalse($this->service->shouldPrefillApplicant($filled));
$this->assertTrue($this->service()->shouldPrefillApplicant($fresh));
$this->assertFalse($this->service()->shouldPrefillApplicant($filled));
}
public function testDummyTokenMatchesInCreateAndEditModes(): void
@@ -259,8 +283,8 @@ class ParticipantDataPrefillerTest extends TestCase
$participant = new ParticipantDto();
$participant->lastName = ParticipantDataPrefiller::TOKEN;
$this->assertTrue($this->service->isDummyDataFillRequested($participant, BookingDto::MODE_CREATE));
$this->assertTrue($this->service->isDummyDataFillRequested($participant, BookingDto::MODE_EDIT));
$this->assertTrue($this->service()->isDummyDataFillRequested($participant, BookingDto::MODE_CREATE));
$this->assertTrue($this->service()->isDummyDataFillRequested($participant, BookingDto::MODE_EDIT));
}
public function testFillDummyParticipantSetsGeneratedData(): void
@@ -268,7 +292,7 @@ class ParticipantDataPrefillerTest extends TestCase
CarbonImmutable::setTestNow(CarbonImmutable::create(2026, 1, 15, 14, 30));
$participant = new ParticipantDto();
$this->service->fillDummyParticipant($participant, 0);
$this->service()->fillDummyParticipant($participant, 0);
$this->assertSame('Vorname 1', $participant->firstName);
$this->assertSame('Muster 1 14:30', $participant->lastName);