chore: major code cleanup and type safety using phpstan
This commit is contained in:
1 parent
060cbea9da
commit
3da73d626b
103 files changed
+976
-1192
No files matched your search
@@ -21,18 +21,18 @@ class ParticipantLicensePlateFieldHandlerTest extends TestCase
|
||||
|
||||
public function testGetFieldName(): void
|
||||
{
|
||||
$this->assertSame('licensePlate', $this->handler->getFieldName());
|
||||
self::assertSame('licensePlate', $this->handler->getFieldName());
|
||||
}
|
||||
|
||||
public function testGetDependencies(): void
|
||||
{
|
||||
$this->assertSame(['parking'], $this->handler->getDependencies());
|
||||
self::assertSame(['parking'], $this->handler->getDependencies());
|
||||
}
|
||||
|
||||
public function testShouldProcessAlwaysReturnsTrue(): void
|
||||
{
|
||||
$this->assertTrue($this->handler->shouldProcess([], BookingDto::MODE_CREATE, 0));
|
||||
$this->assertTrue($this->handler->shouldProcess(['some' => 'data'], BookingDto::MODE_EDIT, 5));
|
||||
self::assertTrue($this->handler->shouldProcess([], BookingDto::MODE_CREATE, 0));
|
||||
self::assertTrue($this->handler->shouldProcess(['some' => 'data'], BookingDto::MODE_EDIT, 5));
|
||||
}
|
||||
|
||||
public function testProcessFieldWithoutParticipant(): void
|
||||
@@ -61,7 +61,7 @@ class ParticipantLicensePlateFieldHandlerTest extends TestCase
|
||||
|
||||
$this->handler->processField($submittedData, $bookingDto, 0);
|
||||
|
||||
$this->assertNull($participant->licensePlate);
|
||||
self::assertNull($participant->licensePlate);
|
||||
}
|
||||
|
||||
public function testProcessFieldSetsLicensePlateWhenParkingSelected(): void
|
||||
@@ -77,7 +77,7 @@ class ParticipantLicensePlateFieldHandlerTest extends TestCase
|
||||
|
||||
$this->handler->processField($submittedData, $bookingDto, 0);
|
||||
|
||||
$this->assertSame('AB-CD 123', $participant->licensePlate);
|
||||
self::assertSame('AB-CD 123', $participant->licensePlate);
|
||||
}
|
||||
|
||||
public function testProcessFieldHandlesEmptyLicensePlate(): void
|
||||
@@ -93,7 +93,7 @@ class ParticipantLicensePlateFieldHandlerTest extends TestCase
|
||||
|
||||
$this->handler->processField($submittedData, $bookingDto, 0);
|
||||
|
||||
$this->assertNull($participant->licensePlate);
|
||||
self::assertNull($participant->licensePlate);
|
||||
}
|
||||
|
||||
public function testProcessFieldHandlesNullLicensePlate(): void
|
||||
@@ -109,7 +109,7 @@ class ParticipantLicensePlateFieldHandlerTest extends TestCase
|
||||
|
||||
$this->handler->processField($submittedData, $bookingDto, 0);
|
||||
|
||||
$this->assertNull($participant->licensePlate);
|
||||
self::assertNull($participant->licensePlate);
|
||||
}
|
||||
|
||||
public function testProcessFieldTrimsWhitespace(): void
|
||||
@@ -125,7 +125,7 @@ class ParticipantLicensePlateFieldHandlerTest extends TestCase
|
||||
|
||||
$this->handler->processField($submittedData, $bookingDto, 0);
|
||||
|
||||
$this->assertSame('AB-CD 123', $participant->licensePlate);
|
||||
self::assertSame('AB-CD 123', $participant->licensePlate);
|
||||
}
|
||||
|
||||
public function testProcessFieldHandlesWhitespaceOnlyAsEmpty(): void
|
||||
@@ -141,7 +141,7 @@ class ParticipantLicensePlateFieldHandlerTest extends TestCase
|
||||
|
||||
$this->handler->processField($submittedData, $bookingDto, 0);
|
||||
|
||||
$this->assertNull($participant->licensePlate);
|
||||
self::assertNull($participant->licensePlate);
|
||||
}
|
||||
|
||||
public function testProcessFieldHandlesNonStringValues(): void
|
||||
@@ -156,12 +156,12 @@ class ParticipantLicensePlateFieldHandlerTest extends TestCase
|
||||
// Test with integer value
|
||||
$submittedData = ['licensePlate' => 123];
|
||||
$this->handler->processField($submittedData, $bookingDto, 0);
|
||||
$this->assertNull($participant->licensePlate);
|
||||
self::assertNull($participant->licensePlate);
|
||||
|
||||
// Test with array value
|
||||
$submittedData = ['licensePlate' => ['invalid']];
|
||||
$this->handler->processField($submittedData, $bookingDto, 0);
|
||||
$this->assertNull($participant->licensePlate);
|
||||
self::assertNull($participant->licensePlate);
|
||||
}
|
||||
|
||||
public function testProcessFieldHandlesMissingLicensePlateField(): void
|
||||
@@ -177,7 +177,7 @@ class ParticipantLicensePlateFieldHandlerTest extends TestCase
|
||||
|
||||
$this->handler->processField($submittedData, $bookingDto, 0);
|
||||
|
||||
$this->assertNull($participant->licensePlate);
|
||||
self::assertNull($participant->licensePlate);
|
||||
}
|
||||
|
||||
public function testProcessFieldWithDifferentParticipantIndex(): void
|
||||
@@ -197,7 +197,7 @@ class ParticipantLicensePlateFieldHandlerTest extends TestCase
|
||||
// Process for participant at index 1
|
||||
$this->handler->processField($submittedData, $bookingDto, 1);
|
||||
|
||||
$this->assertNull($participant1->licensePlate); // Should not be affected
|
||||
$this->assertSame('AB-CD 123', $participant2->licensePlate); // Should be set
|
||||
self::assertNull($participant1->licensePlate); // Should not be affected
|
||||
self::assertSame('AB-CD 123', $participant2->licensePlate); // Should be set
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user