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
@@ -34,16 +34,16 @@ class BookingTest extends TestCase
|
||||
|
||||
// Test: participant 0 should get the ski pass
|
||||
$result = $booking->getSkiPassForParticipant(0);
|
||||
$this->assertSame($skiPassService, $result);
|
||||
$this->assertEquals(123, $result->id);
|
||||
self::assertSame($skiPassService, $result);
|
||||
self::assertEquals(123, $result->id);
|
||||
|
||||
// Test: participant 1 should get null (no ski pass assigned)
|
||||
$result = $booking->getSkiPassForParticipant(1);
|
||||
$this->assertNull($result);
|
||||
self::assertNull($result);
|
||||
|
||||
// Test: participant 2 should get the ski pass
|
||||
$result = $booking->getSkiPassForParticipant(2);
|
||||
$this->assertSame($skiPassService, $result);
|
||||
self::assertSame($skiPassService, $result);
|
||||
}
|
||||
|
||||
public function testGetSkiPassForParticipantReturnsNullWhenNoSkiPasses(): void
|
||||
@@ -59,7 +59,7 @@ class BookingTest extends TestCase
|
||||
$booking->additionalServices = [456 => $otherService];
|
||||
|
||||
$result = $booking->getSkiPassForParticipant(0);
|
||||
$this->assertNull($result);
|
||||
self::assertNull($result);
|
||||
}
|
||||
|
||||
public function testGetSkiPassForParticipantReturnsNullWhenNoServices(): void
|
||||
@@ -68,7 +68,7 @@ class BookingTest extends TestCase
|
||||
$booking->additionalServices = [];
|
||||
|
||||
$result = $booking->getSkiPassForParticipant(0);
|
||||
$this->assertNull($result);
|
||||
self::assertNull($result);
|
||||
}
|
||||
|
||||
public function testGetInsuranceForParticipantReturnsCorrectInsurance(): void
|
||||
@@ -94,21 +94,21 @@ class BookingTest extends TestCase
|
||||
|
||||
// Test: participant 0 should get insurance1
|
||||
$result = $booking->getInsuranceForParticipant(0);
|
||||
$this->assertSame($insurance1, $result);
|
||||
$this->assertEquals(100, $result->id);
|
||||
self::assertSame($insurance1, $result);
|
||||
self::assertEquals(100, $result->id);
|
||||
|
||||
// Test: participant 1 should get insurance2
|
||||
$result = $booking->getInsuranceForParticipant(1);
|
||||
$this->assertSame($insurance2, $result);
|
||||
$this->assertEquals(200, $result->id);
|
||||
self::assertSame($insurance2, $result);
|
||||
self::assertEquals(200, $result->id);
|
||||
|
||||
// Test: participant 2 should get insurance1
|
||||
$result = $booking->getInsuranceForParticipant(2);
|
||||
$this->assertSame($insurance1, $result);
|
||||
self::assertSame($insurance1, $result);
|
||||
|
||||
// Test: participant 3 should get null (no insurance assigned)
|
||||
$result = $booking->getInsuranceForParticipant(3);
|
||||
$this->assertNull($result);
|
||||
self::assertNull($result);
|
||||
}
|
||||
|
||||
public function testGetInsuranceForParticipantReturnsNullWhenNoInsurances(): void
|
||||
@@ -117,7 +117,7 @@ class BookingTest extends TestCase
|
||||
$booking->insurances = [];
|
||||
|
||||
$result = $booking->getInsuranceForParticipant(0);
|
||||
$this->assertNull($result);
|
||||
self::assertNull($result);
|
||||
}
|
||||
|
||||
public function testGetInsuranceForParticipantHandlesEmptyMapping(): void
|
||||
@@ -133,6 +133,6 @@ class BookingTest extends TestCase
|
||||
$booking->insurances = [100 => $insurance];
|
||||
|
||||
$result = $booking->getInsuranceForParticipant(0);
|
||||
$this->assertNull($result, 'Should return null when mapping is empty');
|
||||
self::assertNull($result, 'Should return null when mapping is empty');
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user