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
@@ -38,7 +38,7 @@ class InsuranceMutabilityConditionTest extends TestCase
|
||||
|
||||
$result = $this->condition->evaluate($bookingDto, 0, []);
|
||||
|
||||
$this->assertFalse($result, 'Insurance should always be editable in create flow');
|
||||
self::assertFalse($result, 'Insurance should always be editable in create flow');
|
||||
}
|
||||
|
||||
public function testReadonlyWhen40DaysBeforeTravel(): void
|
||||
@@ -51,7 +51,7 @@ class InsuranceMutabilityConditionTest extends TestCase
|
||||
|
||||
$result = $this->condition->evaluate($bookingDto, 0, []);
|
||||
|
||||
$this->assertTrue($result, 'Insurance should be readonly in edit mode (API limitation)');
|
||||
self::assertTrue($result, 'Insurance should be readonly in edit mode (API limitation)');
|
||||
}
|
||||
|
||||
public function testReadonlyWhenExactly30DaysBeforeTravel(): void
|
||||
@@ -65,7 +65,7 @@ class InsuranceMutabilityConditionTest extends TestCase
|
||||
|
||||
$result = $this->condition->evaluate($bookingDto, 0, []);
|
||||
|
||||
$this->assertTrue($result, 'Insurance should be readonly in edit mode (API limitation)');
|
||||
self::assertTrue($result, 'Insurance should be readonly in edit mode (API limitation)');
|
||||
}
|
||||
|
||||
public function testReadonlyWhen20DaysBeforeTravel(): void
|
||||
@@ -78,7 +78,7 @@ class InsuranceMutabilityConditionTest extends TestCase
|
||||
|
||||
$result = $this->condition->evaluate($bookingDto, 0, []);
|
||||
|
||||
$this->assertTrue($result, 'Insurance should be readonly when 20 days before travel (standard case)');
|
||||
self::assertTrue($result, 'Insurance should be readonly when 20 days before travel (standard case)');
|
||||
}
|
||||
|
||||
public function testReadonlyWhen2DaysAfterLateBooking(): void
|
||||
@@ -92,7 +92,7 @@ class InsuranceMutabilityConditionTest extends TestCase
|
||||
|
||||
$result = $this->condition->evaluate($bookingDto, 0, []);
|
||||
|
||||
$this->assertTrue($result, 'Insurance should be readonly in edit mode (API limitation)');
|
||||
self::assertTrue($result, 'Insurance should be readonly in edit mode (API limitation)');
|
||||
}
|
||||
|
||||
public function testReadonlyWhenExactly3DaysAfterLateBooking(): void
|
||||
@@ -106,7 +106,7 @@ class InsuranceMutabilityConditionTest extends TestCase
|
||||
|
||||
$result = $this->condition->evaluate($bookingDto, 0, []);
|
||||
|
||||
$this->assertTrue($result, 'Insurance should be readonly in edit mode (API limitation)');
|
||||
self::assertTrue($result, 'Insurance should be readonly in edit mode (API limitation)');
|
||||
}
|
||||
|
||||
public function testReadonlyWhen5DaysAfterLateBooking(): void
|
||||
@@ -120,7 +120,7 @@ class InsuranceMutabilityConditionTest extends TestCase
|
||||
|
||||
$result = $this->condition->evaluate($bookingDto, 0, []);
|
||||
|
||||
$this->assertTrue($result, 'Insurance should be readonly 5 days after late booking');
|
||||
self::assertTrue($result, 'Insurance should be readonly 5 days after late booking');
|
||||
}
|
||||
|
||||
public function testReadonlyWhenTravelDatePassed(): void
|
||||
@@ -133,24 +133,24 @@ class InsuranceMutabilityConditionTest extends TestCase
|
||||
|
||||
$result = $this->condition->evaluate($bookingDto, 0, []);
|
||||
|
||||
$this->assertTrue($result, 'Insurance should be readonly when travel date has passed');
|
||||
self::assertTrue($result, 'Insurance should be readonly when travel date has passed');
|
||||
}
|
||||
|
||||
public function testGetDependentFieldsReturnsEmptyArray(): void
|
||||
{
|
||||
$result = $this->condition->getDependentFields();
|
||||
|
||||
$this->assertIsArray($result);
|
||||
$this->assertEmpty($result, 'Insurance mutability has no field dependencies');
|
||||
self::assertIsArray($result);
|
||||
self::assertEmpty($result, 'Insurance mutability has no field dependencies');
|
||||
}
|
||||
|
||||
public function testGetDescriptionReturnsString(): void
|
||||
{
|
||||
$result = $this->condition->getDescription();
|
||||
|
||||
$this->assertIsString($result);
|
||||
$this->assertStringContainsString('not editable', $result);
|
||||
$this->assertStringContainsString('edit mode', $result);
|
||||
self::assertIsString($result);
|
||||
self::assertStringContainsString('not editable', $result);
|
||||
self::assertStringContainsString('edit mode', $result);
|
||||
}
|
||||
|
||||
private function createEditDto(\DateTimeImmutable $travelDate, \DateTimeImmutable $bookingDate): BookingDto
|
||||
|
||||
@@ -25,7 +25,7 @@ class SingleRoomTypeConditionTest extends TestCase
|
||||
|
||||
$result = $this->condition->evaluate($bookingDto, 0, []);
|
||||
|
||||
$this->assertFalse($result, 'Condition should return false when no rooms are selected');
|
||||
self::assertFalse($result, 'Condition should return false when no rooms are selected');
|
||||
}
|
||||
|
||||
public function testReturnsTrueWhenExactlyOneRoomSelected(): void
|
||||
@@ -36,7 +36,7 @@ class SingleRoomTypeConditionTest extends TestCase
|
||||
|
||||
$result = $this->condition->evaluate($bookingDto, 0, []);
|
||||
|
||||
$this->assertTrue($result, 'Condition should return true when exactly one room type is selected');
|
||||
self::assertTrue($result, 'Condition should return true when exactly one room type is selected');
|
||||
}
|
||||
|
||||
public function testReturnsFalseWhenTwoRoomsSelected(): void
|
||||
@@ -48,7 +48,7 @@ class SingleRoomTypeConditionTest extends TestCase
|
||||
|
||||
$result = $this->condition->evaluate($bookingDto, 0, []);
|
||||
|
||||
$this->assertFalse($result, 'Condition should return false when two room types are selected');
|
||||
self::assertFalse($result, 'Condition should return false when two room types are selected');
|
||||
}
|
||||
|
||||
public function testReturnsFalseWhenMultipleRoomsSelected(): void
|
||||
@@ -61,7 +61,7 @@ class SingleRoomTypeConditionTest extends TestCase
|
||||
|
||||
$result = $this->condition->evaluate($bookingDto, 0, []);
|
||||
|
||||
$this->assertFalse($result, 'Condition should return false when multiple room types are selected');
|
||||
self::assertFalse($result, 'Condition should return false when multiple room types are selected');
|
||||
}
|
||||
|
||||
public function testIgnoresRoomsWithZeroQuantity(): void
|
||||
@@ -74,7 +74,7 @@ class SingleRoomTypeConditionTest extends TestCase
|
||||
|
||||
$result = $this->condition->evaluate($bookingDto, 0, []);
|
||||
|
||||
$this->assertTrue($result, 'Condition should ignore rooms with zero quantity');
|
||||
self::assertTrue($result, 'Condition should ignore rooms with zero quantity');
|
||||
}
|
||||
|
||||
public function testIgnoresRoomsWithNullQuantity(): void
|
||||
@@ -86,7 +86,7 @@ class SingleRoomTypeConditionTest extends TestCase
|
||||
|
||||
$result = $this->condition->evaluate($bookingDto, 0, []);
|
||||
|
||||
$this->assertTrue($result, 'Condition should ignore rooms with null quantity');
|
||||
self::assertTrue($result, 'Condition should ignore rooms with null quantity');
|
||||
}
|
||||
|
||||
public function testReturnsFalseWhenAllRoomsHaveZeroQuantity(): void
|
||||
@@ -98,24 +98,24 @@ class SingleRoomTypeConditionTest extends TestCase
|
||||
|
||||
$result = $this->condition->evaluate($bookingDto, 0, []);
|
||||
|
||||
$this->assertFalse($result, 'Condition should return false when all rooms have zero quantity');
|
||||
self::assertFalse($result, 'Condition should return false when all rooms have zero quantity');
|
||||
}
|
||||
|
||||
public function testGetDependentFieldsReturnsEmptyArray(): void
|
||||
{
|
||||
$result = $this->condition->getDependentFields();
|
||||
|
||||
$this->assertIsArray($result);
|
||||
$this->assertEmpty($result, 'Single room type condition has no participant-level field dependencies');
|
||||
self::assertIsArray($result);
|
||||
self::assertEmpty($result, 'Single room type condition has no participant-level field dependencies');
|
||||
}
|
||||
|
||||
public function testGetDescriptionReturnsString(): void
|
||||
{
|
||||
$result = $this->condition->getDescription();
|
||||
|
||||
$this->assertIsString($result);
|
||||
$this->assertStringContainsString('readonly', $result);
|
||||
$this->assertStringContainsString('one room type', $result);
|
||||
self::assertIsString($result);
|
||||
self::assertStringContainsString('readonly', $result);
|
||||
self::assertStringContainsString('one room type', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user