chore: code cleanup with rector and php-cs-fixer
This commit is contained in:
@@ -4,6 +4,8 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Tests\Service;
|
||||
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Form\Model\ParticipantDto;
|
||||
use App\BusProNet\Constants;
|
||||
use App\BusProNet\Model\Room;
|
||||
use App\BusProNet\Model\Service;
|
||||
@@ -192,9 +194,9 @@ class BookingConfiguratorStatusTest extends TestCase
|
||||
$travel->dateFrom = new \DateTimeImmutable('2030-01-01');
|
||||
$travel->dateTo = new \DateTimeImmutable('2030-01-06');
|
||||
|
||||
$bookingDto = new \App\Form\Model\BookingDto($travel, 456);
|
||||
$bookingDto = new BookingDto($travel, 456);
|
||||
$bookingDto->bookingStatus = 'F';
|
||||
$participant = new \App\Form\Model\ParticipantDto();
|
||||
$participant = new ParticipantDto();
|
||||
$participant->additionalServices = [new Service()];
|
||||
$bookingDto->participants = [$participant];
|
||||
|
||||
@@ -223,7 +225,7 @@ class BookingConfiguratorStatusTest extends TestCase
|
||||
$travel->dateFrom = new \DateTimeImmutable('2030-01-01');
|
||||
$travel->dateTo = new \DateTimeImmutable('2030-01-06');
|
||||
|
||||
$bookingDto = new \App\Form\Model\BookingDto($travel, 456);
|
||||
$bookingDto = new BookingDto($travel, 456);
|
||||
$bookingDto->bookingStatus = 'A';
|
||||
|
||||
$bookingService->applyCreateBookingStatusRules($bookingDto);
|
||||
|
||||
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Tests\Service;
|
||||
|
||||
use App\BusProNet\ApiClient;
|
||||
use App\BusProNet\Exception\ApiClientException;
|
||||
use App\BusProNet\Exception\TimeoutException;
|
||||
use App\BusProNet\Model\Booking;
|
||||
@@ -87,7 +88,7 @@ class BookingEditSubmitterTest extends TestCase
|
||||
->with($bookingDto, $freshBookingData)
|
||||
->willReturn(false);
|
||||
|
||||
$apiClient = $this->createMock(\App\BusProNet\ApiClient::class);
|
||||
$apiClient = $this->createMock(ApiClient::class);
|
||||
$apiClient->expects($this->once())
|
||||
->method('updateBooking')
|
||||
->with($bookingDto, true)
|
||||
@@ -137,7 +138,7 @@ class BookingEditSubmitterTest extends TestCase
|
||||
->with($bookingDto, $freshBookingData)
|
||||
->willReturn(false);
|
||||
|
||||
$apiClient = $this->createMock(\App\BusProNet\ApiClient::class);
|
||||
$apiClient = $this->createMock(ApiClient::class);
|
||||
$bookingUpdate = new BookingUpdate();
|
||||
$bookingUpdate->success = false;
|
||||
$bookingUpdate->status = 'BPN-FAIL';
|
||||
@@ -200,7 +201,7 @@ class BookingEditSubmitterTest extends TestCase
|
||||
->with($bookingDto, $freshBookingData)
|
||||
->willReturn(false);
|
||||
|
||||
$apiClient = $this->createMock(\App\BusProNet\ApiClient::class);
|
||||
$apiClient = $this->createMock(ApiClient::class);
|
||||
$bookingUpdate = new BookingUpdate();
|
||||
$bookingUpdate->success = true;
|
||||
$apiClient->expects($this->once())
|
||||
@@ -266,7 +267,7 @@ class BookingEditSubmitterTest extends TestCase
|
||||
->with($bookingDto, $freshBookingData)
|
||||
->willReturn(true);
|
||||
|
||||
$apiClient = $this->createMock(\App\BusProNet\ApiClient::class);
|
||||
$apiClient = $this->createMock(ApiClient::class);
|
||||
$bookingUpdate = new BookingUpdate();
|
||||
$bookingUpdate->success = true;
|
||||
$apiClient->expects($this->once())
|
||||
@@ -350,7 +351,7 @@ class BookingEditSubmitterTest extends TestCase
|
||||
->with($bookingDto, $freshBookingData)
|
||||
->willReturn(false);
|
||||
|
||||
$apiClient = $this->createMock(\App\BusProNet\ApiClient::class);
|
||||
$apiClient = $this->createMock(ApiClient::class);
|
||||
$apiClient->expects($this->once())
|
||||
->method('updateBooking')
|
||||
->with($bookingDto, true)
|
||||
@@ -400,7 +401,7 @@ class BookingEditSubmitterTest extends TestCase
|
||||
->with($bookingDto, $freshBookingData)
|
||||
->willReturn(false);
|
||||
|
||||
$apiClient = $this->createMock(\App\BusProNet\ApiClient::class);
|
||||
$apiClient = $this->createMock(ApiClient::class);
|
||||
$apiClient->expects($this->once())
|
||||
->method('updateBooking')
|
||||
->with($bookingDto, true)
|
||||
@@ -421,7 +422,7 @@ class BookingEditSubmitterTest extends TestCase
|
||||
}
|
||||
|
||||
private function createService(
|
||||
?\App\BusProNet\ApiClient $apiClient = null,
|
||||
?ApiClient $apiClient = null,
|
||||
?BookingEditDataLoader $dataLoader = null,
|
||||
?BookingEditDraftManager $draftService = null,
|
||||
?TravelDataProvider $travelDataService = null,
|
||||
@@ -429,7 +430,7 @@ class BookingEditSubmitterTest extends TestCase
|
||||
?BookingSessionManager $bookingSessionService = null,
|
||||
): BookingEditSubmitter {
|
||||
return new BookingEditSubmitter(
|
||||
$apiClient ?? $this->createMock(\App\BusProNet\ApiClient::class),
|
||||
$apiClient ?? $this->createMock(ApiClient::class),
|
||||
$dataLoader ?? $this->createMock(BookingEditDataLoader::class),
|
||||
$draftService ?? $this->createMock(BookingEditDraftManager::class),
|
||||
$travelDataService ?? $this->createMock(TravelDataProvider::class),
|
||||
|
||||
@@ -4,6 +4,9 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Tests\Service;
|
||||
|
||||
use Symfony\Component\Validator\ConstraintViolationListInterface;
|
||||
use Symfony\Component\Validator\ConstraintViolationInterface;
|
||||
use Symfony\Component\Validator\ConstraintViolationList;
|
||||
use App\BusProNet\Model\Room;
|
||||
use App\BusProNet\Model\Travel;
|
||||
use App\Form\Model\BookingDto;
|
||||
@@ -384,7 +387,7 @@ class ParticipantCardAssemblerTest extends TestCase
|
||||
->willReturn([450.50]);
|
||||
|
||||
// Mock validator to return no violations (valid)
|
||||
$violations = $this->createMock(\Symfony\Component\Validator\ConstraintViolationListInterface::class);
|
||||
$violations = $this->createMock(ConstraintViolationListInterface::class);
|
||||
$violations->expects($this->once())
|
||||
->method('count')
|
||||
->willReturn(0);
|
||||
@@ -422,13 +425,13 @@ class ParticipantCardAssemblerTest extends TestCase
|
||||
->willReturn([0.0]);
|
||||
|
||||
// Mock validator to return violations (invalid)
|
||||
$violation = $this->createMock(\Symfony\Component\Validator\ConstraintViolationInterface::class);
|
||||
$violation = $this->createMock(ConstraintViolationInterface::class);
|
||||
$violation->expects($this->once())
|
||||
->method('getMessage')
|
||||
->willReturn('Diese E-Mail Adresse wird bereits von einem anderen Teilnehmer verwendet');
|
||||
|
||||
// Use ConstraintViolationList directly instead of mocking
|
||||
$violations = new \Symfony\Component\Validator\ConstraintViolationList([$violation]);
|
||||
$violations = new ConstraintViolationList([$violation]);
|
||||
|
||||
$this->validator
|
||||
->expects($this->once())
|
||||
@@ -473,7 +476,7 @@ class ParticipantCardAssemblerTest extends TestCase
|
||||
->willReturn([450.0, 500.0]);
|
||||
|
||||
// Mock validator to return no violations for both participants
|
||||
$violations = $this->createMock(\Symfony\Component\Validator\ConstraintViolationListInterface::class);
|
||||
$violations = $this->createMock(ConstraintViolationListInterface::class);
|
||||
$violations->expects($this->exactly(2))
|
||||
->method('count')
|
||||
->willReturn(0);
|
||||
|
||||
Reference in New Issue
Block a user