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
@@ -15,7 +15,7 @@ class ParticipantDtoTest extends TestCase
|
||||
$participant = new ParticipantDto();
|
||||
$participant->dateOfBirth = null;
|
||||
|
||||
$this->assertNull($participant->getAge());
|
||||
self::assertNull($participant->getAge());
|
||||
}
|
||||
|
||||
public function testGetAgeCalculatesCurrentAgeWhenNoReferenceDateProvided(): void
|
||||
@@ -26,7 +26,7 @@ class ParticipantDtoTest extends TestCase
|
||||
$expectedAge = (new \DateTimeImmutable())->diff($participant->dateOfBirth)->y;
|
||||
$actualAge = $participant->getAge();
|
||||
|
||||
$this->assertEquals($expectedAge, $actualAge);
|
||||
self::assertEquals($expectedAge, $actualAge);
|
||||
}
|
||||
|
||||
public function testGetAgeCalculatesAgeAtSpecificReferenceDate(): void
|
||||
@@ -37,7 +37,7 @@ class ParticipantDtoTest extends TestCase
|
||||
|
||||
$result = $participant->getAge($referenceDate);
|
||||
|
||||
$this->assertEquals(33, $result); // Still 33 years old
|
||||
self::assertEquals(33, $result); // Still 33 years old
|
||||
}
|
||||
|
||||
public function testGetAgeCalculatesAgeAtSpecificReferenceDateAfterBirthday(): void
|
||||
@@ -48,7 +48,7 @@ class ParticipantDtoTest extends TestCase
|
||||
|
||||
$result = $participant->getAge($referenceDate);
|
||||
|
||||
$this->assertEquals(34, $result); // Now 34 years old
|
||||
self::assertEquals(34, $result); // Now 34 years old
|
||||
}
|
||||
|
||||
public function testGetAgeCalculatesAgeForInsuranceEligibilityScenario(): void
|
||||
@@ -61,7 +61,7 @@ class ParticipantDtoTest extends TestCase
|
||||
$result = $participant->getAge($travelStartDate);
|
||||
|
||||
// On 2024-08-01, they are still 34 (birthday not yet reached)
|
||||
$this->assertEquals(34, $result);
|
||||
self::assertEquals(34, $result);
|
||||
}
|
||||
|
||||
public function testGetAgeCalculatesAgeForInsuranceEligibilityScenarioAfterBirthday(): void
|
||||
@@ -74,7 +74,7 @@ class ParticipantDtoTest extends TestCase
|
||||
$result = $participant->getAge($travelStartDate);
|
||||
|
||||
// On 2024-12-26, they just turned 35
|
||||
$this->assertEquals(35, $result);
|
||||
self::assertEquals(35, $result);
|
||||
}
|
||||
|
||||
public function testGetAgeHandlesLeapYearScenarios(): void
|
||||
@@ -86,7 +86,7 @@ class ParticipantDtoTest extends TestCase
|
||||
|
||||
$result = $participant->getAge($referenceDate);
|
||||
|
||||
$this->assertEquals(22, $result); // Still 22, birthday is technically next day
|
||||
self::assertEquals(22, $result); // Still 22, birthday is technically next day
|
||||
}
|
||||
|
||||
public function testGetAgeReturnsNullWithReferenceDateWhenDateOfBirthIsNull(): void
|
||||
@@ -97,7 +97,7 @@ class ParticipantDtoTest extends TestCase
|
||||
|
||||
$result = $participant->getAge($referenceDate);
|
||||
|
||||
$this->assertNull($result);
|
||||
self::assertNull($result);
|
||||
}
|
||||
|
||||
public function testGetAgeWithYoungParticipant(): void
|
||||
@@ -109,7 +109,7 @@ class ParticipantDtoTest extends TestCase
|
||||
|
||||
$result = $participant->getAge($referenceDate);
|
||||
|
||||
$this->assertEquals(4, $result);
|
||||
self::assertEquals(4, $result);
|
||||
}
|
||||
|
||||
public function testGetAgeWithElderlyParticipant(): void
|
||||
@@ -121,7 +121,7 @@ class ParticipantDtoTest extends TestCase
|
||||
|
||||
$result = $participant->getAge($referenceDate);
|
||||
|
||||
$this->assertEquals(84, $result);
|
||||
self::assertEquals(84, $result);
|
||||
}
|
||||
|
||||
public function testHasInsuranceReturnsFalseWhenNoInsuranceSelected(): void
|
||||
@@ -131,7 +131,7 @@ class ParticipantDtoTest extends TestCase
|
||||
|
||||
$result = $participant->hasInsuranceSelected();
|
||||
|
||||
$this->assertFalse($result);
|
||||
self::assertFalse($result);
|
||||
}
|
||||
|
||||
public function testHasInsuranceReturnsTrueWhenInsuranceSelected(): void
|
||||
@@ -141,7 +141,7 @@ class ParticipantDtoTest extends TestCase
|
||||
|
||||
$result = $participant->hasInsuranceSelected();
|
||||
|
||||
$this->assertTrue($result);
|
||||
self::assertTrue($result);
|
||||
}
|
||||
|
||||
public function testGetInsuranceLabelReturnsNullWhenNoInsurance(): void
|
||||
@@ -151,7 +151,7 @@ class ParticipantDtoTest extends TestCase
|
||||
|
||||
$result = $participant->getInsuranceLabel();
|
||||
|
||||
$this->assertNull($result);
|
||||
self::assertNull($result);
|
||||
}
|
||||
|
||||
public function testGetInsuranceLabelReturnsLabelWhenInsuranceSelected(): void
|
||||
@@ -161,7 +161,7 @@ class ParticipantDtoTest extends TestCase
|
||||
|
||||
$result = $participant->getInsuranceLabel();
|
||||
|
||||
$this->assertEquals('Reise-Rücktritt', $result);
|
||||
self::assertEquals('Reise-Rücktritt', $result);
|
||||
}
|
||||
|
||||
public function testGetInsurancePriceReturnsZeroWhenNoInsurance(): void
|
||||
@@ -171,7 +171,7 @@ class ParticipantDtoTest extends TestCase
|
||||
|
||||
$result = $participant->getInsurancePrice();
|
||||
|
||||
$this->assertEquals(0.0, $result);
|
||||
self::assertEquals(0.0, $result);
|
||||
}
|
||||
|
||||
public function testGetInsurancePriceReturnsPriceWhenInsuranceSelected(): void
|
||||
@@ -181,7 +181,7 @@ class ParticipantDtoTest extends TestCase
|
||||
|
||||
$result = $participant->getInsurancePrice();
|
||||
|
||||
$this->assertEquals(25.50, $result);
|
||||
self::assertEquals(25.50, $result);
|
||||
}
|
||||
|
||||
public function testGetInsurancePriceReturnsZeroWhenInsuranceHasNullPrice(): void
|
||||
@@ -193,7 +193,7 @@ class ParticipantDtoTest extends TestCase
|
||||
|
||||
$result = $participant->getInsurancePrice();
|
||||
|
||||
$this->assertEquals(0.0, $result);
|
||||
self::assertEquals(0.0, $result);
|
||||
}
|
||||
|
||||
private function createInsurance(string $label = 'Test Insurance', float $price = 10.0): Insurance
|
||||
|
||||
Reference in new issue
Block a user