wip: modernized edit flow, fix insurance tier calculation
This commit is contained in:
@@ -5,7 +5,7 @@ declare(strict_types=1);
|
||||
namespace App\Tests\Form\Service;
|
||||
|
||||
use App\BusProNet\Model\Travel;
|
||||
use App\Form\Model\BookingCreateDto;
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Form\Model\ParticipantDto;
|
||||
use App\Form\Service\ParticipantLicensePlateFieldHandler;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
@@ -38,7 +38,7 @@ class ParticipantLicensePlateFieldHandlerTest extends TestCase
|
||||
public function testProcessFieldWithoutParticipant(): void
|
||||
{
|
||||
$travel = new Travel();
|
||||
$bookingDto = new BookingCreateDto($travel, 1);
|
||||
$bookingDto = new BookingDto($travel, 1);
|
||||
$submittedData = ['licensePlate' => 'AB-CD 123'];
|
||||
|
||||
$this->handler->processField($submittedData, $bookingDto, 0);
|
||||
@@ -54,7 +54,7 @@ class ParticipantLicensePlateFieldHandlerTest extends TestCase
|
||||
$participant->licensePlate = 'AB-CD 123'; // Should be cleared
|
||||
|
||||
$travel = new Travel();
|
||||
$bookingDto = new BookingCreateDto($travel, 1);
|
||||
$bookingDto = new BookingDto($travel, 1);
|
||||
$bookingDto->participants = [$participant];
|
||||
|
||||
$submittedData = ['licensePlate' => 'XY-ZZ 999'];
|
||||
@@ -70,7 +70,7 @@ class ParticipantLicensePlateFieldHandlerTest extends TestCase
|
||||
$participant->parking = true; // Parking selected
|
||||
|
||||
$travel = new Travel();
|
||||
$bookingDto = new BookingCreateDto($travel, 1);
|
||||
$bookingDto = new BookingDto($travel, 1);
|
||||
$bookingDto->participants = [$participant];
|
||||
|
||||
$submittedData = ['licensePlate' => 'AB-CD 123'];
|
||||
@@ -86,7 +86,7 @@ class ParticipantLicensePlateFieldHandlerTest extends TestCase
|
||||
$participant->parking = true; // Parking selected
|
||||
|
||||
$travel = new Travel();
|
||||
$bookingDto = new BookingCreateDto($travel, 1);
|
||||
$bookingDto = new BookingDto($travel, 1);
|
||||
$bookingDto->participants = [$participant];
|
||||
|
||||
$submittedData = ['licensePlate' => ''];
|
||||
@@ -102,7 +102,7 @@ class ParticipantLicensePlateFieldHandlerTest extends TestCase
|
||||
$participant->parking = true; // Parking selected
|
||||
|
||||
$travel = new Travel();
|
||||
$bookingDto = new BookingCreateDto($travel, 1);
|
||||
$bookingDto = new BookingDto($travel, 1);
|
||||
$bookingDto->participants = [$participant];
|
||||
|
||||
$submittedData = ['licensePlate' => null];
|
||||
@@ -118,7 +118,7 @@ class ParticipantLicensePlateFieldHandlerTest extends TestCase
|
||||
$participant->parking = true; // Parking selected
|
||||
|
||||
$travel = new Travel();
|
||||
$bookingDto = new BookingCreateDto($travel, 1);
|
||||
$bookingDto = new BookingDto($travel, 1);
|
||||
$bookingDto->participants = [$participant];
|
||||
|
||||
$submittedData = ['licensePlate' => ' AB-CD 123 '];
|
||||
@@ -134,7 +134,7 @@ class ParticipantLicensePlateFieldHandlerTest extends TestCase
|
||||
$participant->parking = true; // Parking selected
|
||||
|
||||
$travel = new Travel();
|
||||
$bookingDto = new BookingCreateDto($travel, 1);
|
||||
$bookingDto = new BookingDto($travel, 1);
|
||||
$bookingDto->participants = [$participant];
|
||||
|
||||
$submittedData = ['licensePlate' => ' '];
|
||||
@@ -150,7 +150,7 @@ class ParticipantLicensePlateFieldHandlerTest extends TestCase
|
||||
$participant->parking = true; // Parking selected
|
||||
|
||||
$travel = new Travel();
|
||||
$bookingDto = new BookingCreateDto($travel, 1);
|
||||
$bookingDto = new BookingDto($travel, 1);
|
||||
$bookingDto->participants = [$participant];
|
||||
|
||||
// Test with integer value
|
||||
@@ -170,7 +170,7 @@ class ParticipantLicensePlateFieldHandlerTest extends TestCase
|
||||
$participant->parking = true; // Parking selected
|
||||
|
||||
$travel = new Travel();
|
||||
$bookingDto = new BookingCreateDto($travel, 1);
|
||||
$bookingDto = new BookingDto($travel, 1);
|
||||
$bookingDto->participants = [$participant];
|
||||
|
||||
$submittedData = []; // No licensePlate field
|
||||
@@ -189,7 +189,7 @@ class ParticipantLicensePlateFieldHandlerTest extends TestCase
|
||||
$participant2->parking = true;
|
||||
|
||||
$travel = new Travel();
|
||||
$bookingDto = new BookingCreateDto($travel, 1);
|
||||
$bookingDto = new BookingDto($travel, 1);
|
||||
$bookingDto->participants = [$participant1, $participant2];
|
||||
|
||||
$submittedData = ['licensePlate' => 'AB-CD 123'];
|
||||
|
||||
Reference in New Issue
Block a user