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
@@ -24,12 +24,12 @@ class ParticipantDropOffFieldHandlerTest extends TestCase
|
||||
|
||||
public function testGetFieldName(): void
|
||||
{
|
||||
$this->assertSame('dropOff', $this->handler->getFieldName());
|
||||
self::assertSame('dropOff', $this->handler->getFieldName());
|
||||
}
|
||||
|
||||
public function testGetDependencies(): void
|
||||
{
|
||||
$this->assertSame(
|
||||
self::assertSame(
|
||||
['transportationOutbound', 'transportationInbound', 'pickup'],
|
||||
$this->handler->getDependencies()
|
||||
);
|
||||
@@ -37,8 +37,8 @@ class ParticipantDropOffFieldHandlerTest extends TestCase
|
||||
|
||||
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
|
||||
@@ -69,9 +69,9 @@ class ParticipantDropOffFieldHandlerTest extends TestCase
|
||||
$this->handler->processField($submittedData, $bookingDto, 0);
|
||||
|
||||
$participant = $bookingDto->getParticipant(0);
|
||||
$this->assertNotNull($participant->dropOff);
|
||||
$this->assertSame(10, $participant->dropOff->id);
|
||||
$this->assertTrue($participant->differentDropOff);
|
||||
self::assertNotNull($participant->dropOff);
|
||||
self::assertSame(10, $participant->dropOff->id);
|
||||
self::assertTrue($participant->differentDropOff);
|
||||
}
|
||||
|
||||
public function testBusBusCheckboxUncheckedAssignsMatchingDropOff(): void
|
||||
@@ -98,9 +98,9 @@ class ParticipantDropOffFieldHandlerTest extends TestCase
|
||||
|
||||
$this->handler->processField($submittedData, $bookingDto, 0);
|
||||
|
||||
$this->assertNotNull($participant->dropOff);
|
||||
$this->assertSame(10, $participant->dropOff->id);
|
||||
$this->assertFalse($participant->differentDropOff);
|
||||
self::assertNotNull($participant->dropOff);
|
||||
self::assertSame(10, $participant->dropOff->id);
|
||||
self::assertFalse($participant->differentDropOff);
|
||||
}
|
||||
|
||||
public function testBusBusCheckboxUncheckedNoPickupKeepsDropOffNull(): void
|
||||
@@ -121,8 +121,8 @@ class ParticipantDropOffFieldHandlerTest extends TestCase
|
||||
|
||||
$this->handler->processField($submittedData, $bookingDto, 0);
|
||||
|
||||
$this->assertNull($participant->dropOff);
|
||||
$this->assertFalse($participant->differentDropOff);
|
||||
self::assertNull($participant->dropOff);
|
||||
self::assertFalse($participant->differentDropOff);
|
||||
}
|
||||
|
||||
public function testBusBusCheckboxUncheckedPickupWithNoMatchingDropOff(): void
|
||||
@@ -147,8 +147,8 @@ class ParticipantDropOffFieldHandlerTest extends TestCase
|
||||
|
||||
$this->handler->processField($submittedData, $bookingDto, 0);
|
||||
|
||||
$this->assertNull($participant->dropOff);
|
||||
$this->assertFalse($participant->differentDropOff);
|
||||
self::assertNull($participant->dropOff);
|
||||
self::assertFalse($participant->differentDropOff);
|
||||
}
|
||||
|
||||
public function testPkwBusValidSelection(): void
|
||||
@@ -167,9 +167,9 @@ class ParticipantDropOffFieldHandlerTest extends TestCase
|
||||
$this->handler->processField($submittedData, $bookingDto, 0);
|
||||
|
||||
$participant = $bookingDto->getParticipant(0);
|
||||
$this->assertNotNull($participant->dropOff);
|
||||
$this->assertSame(20, $participant->dropOff->id);
|
||||
$this->assertFalse($participant->differentDropOff);
|
||||
self::assertNotNull($participant->dropOff);
|
||||
self::assertSame(20, $participant->dropOff->id);
|
||||
self::assertFalse($participant->differentDropOff);
|
||||
}
|
||||
|
||||
public function testBusPkwClearsDropOff(): void
|
||||
@@ -189,8 +189,8 @@ class ParticipantDropOffFieldHandlerTest extends TestCase
|
||||
|
||||
$this->handler->processField($submittedData, $bookingDto, 0);
|
||||
|
||||
$this->assertNull($participant->dropOff);
|
||||
$this->assertFalse($participant->differentDropOff);
|
||||
self::assertNull($participant->dropOff);
|
||||
self::assertFalse($participant->differentDropOff);
|
||||
}
|
||||
|
||||
public function testPkwPkwClearsDropOff(): void
|
||||
@@ -209,8 +209,8 @@ class ParticipantDropOffFieldHandlerTest extends TestCase
|
||||
|
||||
$this->handler->processField($submittedData, $bookingDto, 0);
|
||||
|
||||
$this->assertNull($participant->dropOff);
|
||||
$this->assertFalse($participant->differentDropOff);
|
||||
self::assertNull($participant->dropOff);
|
||||
self::assertFalse($participant->differentDropOff);
|
||||
}
|
||||
|
||||
public function testInvalidDropOffIdSetsNull(): void
|
||||
@@ -229,7 +229,7 @@ class ParticipantDropOffFieldHandlerTest extends TestCase
|
||||
$this->handler->processField($submittedData, $bookingDto, 0);
|
||||
|
||||
$participant = $bookingDto->getParticipant(0);
|
||||
$this->assertNull($participant->dropOff);
|
||||
self::assertNull($participant->dropOff);
|
||||
}
|
||||
|
||||
public function testBusBusCheckboxCheckedNoSelection(): void
|
||||
@@ -248,8 +248,8 @@ class ParticipantDropOffFieldHandlerTest extends TestCase
|
||||
$this->handler->processField($submittedData, $bookingDto, 0);
|
||||
|
||||
$participant = $bookingDto->getParticipant(0);
|
||||
$this->assertNull($participant->dropOff);
|
||||
$this->assertTrue($participant->differentDropOff);
|
||||
self::assertNull($participant->dropOff);
|
||||
self::assertTrue($participant->differentDropOff);
|
||||
}
|
||||
|
||||
private function createDropOff(int $id, string $label): Pickup
|
||||
|
||||
Reference in new issue
Block a user