chore: code cleanup with rector and php-cs-fixer
This commit is contained in:
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||||||
namespace App\BusProNet\DataProcessor;
|
namespace App\BusProNet\DataProcessor;
|
||||||
|
|
||||||
use App\BusProNet\Model\Booking;
|
use App\BusProNet\Model\Booking;
|
||||||
|
use App\BusProNet\Model\Service;
|
||||||
use App\BusProNet\Model\Travel;
|
use App\BusProNet\Model\Travel;
|
||||||
use App\Form\Model\ParticipantDto;
|
use App\Form\Model\ParticipantDto;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
@@ -120,7 +121,7 @@ class ParticipantServiceProcessor
|
|||||||
*
|
*
|
||||||
* @param ParticipantDto $participant The participant data
|
* @param ParticipantDto $participant The participant data
|
||||||
*
|
*
|
||||||
* @return array<\App\BusProNet\Model\Service> Array of services selected by this participant
|
* @return array<Service> Array of services selected by this participant
|
||||||
*/
|
*/
|
||||||
private function collectParticipantAdditionalServices(ParticipantDto $participant): array
|
private function collectParticipantAdditionalServices(ParticipantDto $participant): array
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ use App\BusProNet\Constants;
|
|||||||
use App\BusProNet\Model\Address;
|
use App\BusProNet\Model\Address;
|
||||||
use App\BusProNet\Model\BankAccount;
|
use App\BusProNet\Model\BankAccount;
|
||||||
use App\BusProNet\Model\Booking;
|
use App\BusProNet\Model\Booking;
|
||||||
use App\BusProNet\Model\Communication;
|
|
||||||
use App\BusProNet\Model\PersonalData;
|
use App\BusProNet\Model\PersonalData;
|
||||||
use Symfony\Component\DomCrawler\Crawler;
|
use Symfony\Component\DomCrawler\Crawler;
|
||||||
|
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ namespace App\Command;
|
|||||||
use App\BusProNet\Model\XmlExportInfo;
|
use App\BusProNet\Model\XmlExportInfo;
|
||||||
use App\Model\BpnXmlSnapshotRefreshResult;
|
use App\Model\BpnXmlSnapshotRefreshResult;
|
||||||
use App\Model\BpnXmlSyncTarget;
|
use App\Model\BpnXmlSyncTarget;
|
||||||
use App\Service\BpnXmlSyncManager;
|
|
||||||
use App\Service\BpnXmlSnapshotRefreshManager;
|
use App\Service\BpnXmlSnapshotRefreshManager;
|
||||||
|
use App\Service\BpnXmlSyncManager;
|
||||||
use League\Flysystem\FilesystemException;
|
use League\Flysystem\FilesystemException;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
use Symfony\Component\Console\Attribute\AsCommand;
|
use Symfony\Component\Console\Attribute\AsCommand;
|
||||||
@@ -183,8 +183,7 @@ class BpnXmlSyncCommand extends Command
|
|||||||
bool $dryRun,
|
bool $dryRun,
|
||||||
SymfonyStyle $io,
|
SymfonyStyle $io,
|
||||||
OutputInterface $output,
|
OutputInterface $output,
|
||||||
): array
|
): array {
|
||||||
{
|
|
||||||
$datasetName = $target->name;
|
$datasetName = $target->name;
|
||||||
|
|
||||||
$remoteInfo = $this->syncManager->readRemoteInfo($target->source, $datasetName);
|
$remoteInfo = $this->syncManager->readRemoteInfo($target->source, $datasetName);
|
||||||
|
|||||||
@@ -32,9 +32,9 @@ final class MailjetNewsletterWebhookCommand extends Command
|
|||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly MailjetApiClient $mailjetApiClient,
|
private readonly MailjetApiClient $mailjetApiClient,
|
||||||
#[Autowire('%env(APP_BASE_URL)%')]
|
#[Autowire(env: 'APP_BASE_URL')]
|
||||||
private readonly string $defaultBaseUrl,
|
private readonly string $defaultBaseUrl,
|
||||||
#[Autowire('%env(MAILJET_WEBHOOK_BASIC_PASSWORD)%')]
|
#[Autowire(env: 'MAILJET_WEBHOOK_BASIC_PASSWORD')]
|
||||||
private readonly string $basicAuthPassword,
|
private readonly string $basicAuthPassword,
|
||||||
private readonly LoggerInterface $logger,
|
private readonly LoggerInterface $logger,
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -10,12 +10,12 @@ use App\BusProNet\Model\Notification;
|
|||||||
use App\BusProNet\Model\PersonalData;
|
use App\BusProNet\Model\PersonalData;
|
||||||
use App\Entity\User;
|
use App\Entity\User;
|
||||||
use App\Exception\NewsletterProviderException;
|
use App\Exception\NewsletterProviderException;
|
||||||
use App\Htmx\HxTrait;
|
|
||||||
use App\Form\PersonalDataType;
|
use App\Form\PersonalDataType;
|
||||||
|
use App\Htmx\HxTrait;
|
||||||
use App\Model\NewsletterSubscriptionRequestResult;
|
use App\Model\NewsletterSubscriptionRequestResult;
|
||||||
use App\Service\NewsletterManager;
|
|
||||||
use App\Security\Crypt;
|
use App\Security\Crypt;
|
||||||
use App\Service\BookingEditDataLoader;
|
use App\Service\BookingEditDataLoader;
|
||||||
|
use App\Service\NewsletterManager;
|
||||||
use App\Service\ProfileCompletenessChecker;
|
use App\Service\ProfileCompletenessChecker;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
@@ -39,24 +39,23 @@ class PersonalDataController extends AbstractController
|
|||||||
public const SESSION_REDIRECT_KEY = '_profile_completion_redirect';
|
public const SESSION_REDIRECT_KEY = '_profile_completion_redirect';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param ApiClient $apiClient BusProNet API client for data operations
|
* @param ApiClient $apiClient BusProNet API client for data operations
|
||||||
* @param Crypt $crypt Encryption service for password handling
|
* @param Crypt $crypt Encryption service for password handling
|
||||||
* @param BookingEditDataLoader $dataLoader Data loader for cache invalidation
|
* @param BookingEditDataLoader $dataLoader Data loader for cache invalidation
|
||||||
* @param ProfileCompletenessChecker $completenessChecker Profile validation service
|
* @param ProfileCompletenessChecker $completenessChecker Profile validation service
|
||||||
* @param EntityManagerInterface $entityManager Entity manager for persisting user changes
|
* @param EntityManagerInterface $entityManager Entity manager for persisting user changes
|
||||||
* @param NewsletterManager $newsletterManager Newsletter confirmation service
|
* @param NewsletterManager $newsletterManager Newsletter confirmation service
|
||||||
* @param LoggerInterface $logger Logger for audit trails and debugging
|
* @param LoggerInterface $logger Logger for audit trails and debugging
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly ApiClient $apiClient,
|
private readonly ApiClient $apiClient,
|
||||||
private readonly Crypt $crypt,
|
private readonly Crypt $crypt,
|
||||||
private readonly BookingEditDataLoader $dataLoader,
|
private readonly BookingEditDataLoader $dataLoader,
|
||||||
private readonly ProfileCompletenessChecker $completenessChecker,
|
private readonly ProfileCompletenessChecker $completenessChecker,
|
||||||
private readonly EntityManagerInterface $entityManager,
|
private readonly EntityManagerInterface $entityManager,
|
||||||
private readonly NewsletterManager $newsletterManager,
|
private readonly NewsletterManager $newsletterManager,
|
||||||
private readonly LoggerInterface $logger,
|
private readonly LoggerInterface $logger,
|
||||||
)
|
) {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -125,7 +124,7 @@ class PersonalDataController extends AbstractController
|
|||||||
|
|
||||||
return $this->render('account/personal_data.html.twig', [
|
return $this->render('account/personal_data.html.twig', [
|
||||||
'personalData' => $personalData,
|
'personalData' => $personalData,
|
||||||
'personalDataForm' => $personalDataForm->createView(),
|
'personalDataForm' => $personalDataForm,
|
||||||
'newsletterSubscribed' => $newsletterSubscribed,
|
'newsletterSubscribed' => $newsletterSubscribed,
|
||||||
'newsletterPendingConfirmation' => $newsletterPendingConfirmation,
|
'newsletterPendingConfirmation' => $newsletterPendingConfirmation,
|
||||||
]);
|
]);
|
||||||
@@ -149,7 +148,6 @@ class PersonalDataController extends AbstractController
|
|||||||
$result = $this->newsletterManager->requestDefaultListSubscription($email, $personalData->firstName, $personalData->name);
|
$result = $this->newsletterManager->requestDefaultListSubscription($email, $personalData->firstName, $personalData->name);
|
||||||
$this->addFlash(...$this->newsletterRequestFlash($result));
|
$this->addFlash(...$this->newsletterRequestFlash($result));
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (NewsletterProviderException|\InvalidArgumentException $e) {
|
} catch (NewsletterProviderException|\InvalidArgumentException $e) {
|
||||||
$this->addFlash('error', 'Die Newsletter-Aktion konnte gerade nicht verarbeitet werden. Bitte versuche es erneut.');
|
$this->addFlash('error', 'Die Newsletter-Aktion konnte gerade nicht verarbeitet werden. Bitte versuche es erneut.');
|
||||||
$this->logger->warning('Newsletter action failed', [
|
$this->logger->warning('Newsletter action failed', [
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class NewsletterSubscriptionController extends AbstractController
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[Route('/newsletters', name: 'api_newsletters_all', methods: ['GET'])]
|
#[Route('/newsletters', name: 'api_newsletters_all', methods: ['GET'])]
|
||||||
public function index():JsonResponse
|
public function index(): JsonResponse
|
||||||
{
|
{
|
||||||
return $this->json($this->newsletterManager->createListIdMapping(array_keys($this->mailjetLists)));
|
return $this->json($this->newsletterManager->createListIdMapping(array_keys($this->mailjetLists)));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ class Step1Controller extends AbstractBookingCreateController
|
|||||||
|
|
||||||
return $this->render('booking/create/step_1.html.twig', [
|
return $this->render('booking/create/step_1.html.twig', [
|
||||||
'bookingCreateContext' => $context,
|
'bookingCreateContext' => $context,
|
||||||
'form' => $form->createView(),
|
'form' => $form,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ declare(strict_types=1);
|
|||||||
namespace App\Controller\Booking\Create;
|
namespace App\Controller\Booking\Create;
|
||||||
|
|
||||||
use App\BusProNet\Model\Travel;
|
use App\BusProNet\Model\Travel;
|
||||||
|
use App\Entity\User;
|
||||||
use App\Exception\BookingSessionNotFoundException;
|
use App\Exception\BookingSessionNotFoundException;
|
||||||
use App\Exception\HotelNotInTravelException;
|
use App\Exception\HotelNotInTravelException;
|
||||||
use App\Exception\TravelNotFoundException;
|
use App\Exception\TravelNotFoundException;
|
||||||
use App\Entity\User;
|
|
||||||
use App\Form\BookingCreateStep2Type;
|
use App\Form\BookingCreateStep2Type;
|
||||||
use App\Form\Model\BookingDto;
|
use App\Form\Model\BookingDto;
|
||||||
use App\Form\Model\ParticipantDto;
|
use App\Form\Model\ParticipantDto;
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ class Step2ParticipantController extends AbstractController
|
|||||||
);
|
);
|
||||||
|
|
||||||
return $this->render('booking/create/step_2_participant.html.twig', [
|
return $this->render('booking/create/step_2_participant.html.twig', [
|
||||||
'form' => $form->createView(),
|
'form' => $form,
|
||||||
'participantIndex' => $index,
|
'participantIndex' => $index,
|
||||||
'bookingCreateContext' => $bookingCreateContext,
|
'bookingCreateContext' => $bookingCreateContext,
|
||||||
'bookingDto' => $bookingCreateContext->bookingDto,
|
'bookingDto' => $bookingCreateContext->bookingDto,
|
||||||
|
|||||||
@@ -228,7 +228,7 @@ class Step3Controller extends AbstractBookingCreateController
|
|||||||
|
|
||||||
return $this->render('booking/create/step_3.html.twig', [
|
return $this->render('booking/create/step_3.html.twig', [
|
||||||
'bookingCreateContext' => $context,
|
'bookingCreateContext' => $context,
|
||||||
'form' => $form->createView(),
|
'form' => $form,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ class Step4Controller extends AbstractBookingCreateController
|
|||||||
|
|
||||||
return $this->render('booking/create/step_4.html.twig', [
|
return $this->render('booking/create/step_4.html.twig', [
|
||||||
'bookingCreateContext' => $bookingCreateContext,
|
'bookingCreateContext' => $bookingCreateContext,
|
||||||
'form' => $form->createView(),
|
'form' => $form,
|
||||||
'newsletterOptInVisible' => $newsletterOptInVisible,
|
'newsletterOptInVisible' => $newsletterOptInVisible,
|
||||||
'newsletterTargetEmail' => $newsletterTargetEmail,
|
'newsletterTargetEmail' => $newsletterTargetEmail,
|
||||||
]);
|
]);
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ use App\Entity\User;
|
|||||||
use App\Exception\TravelNotFoundException;
|
use App\Exception\TravelNotFoundException;
|
||||||
use App\Form\BookingEditType;
|
use App\Form\BookingEditType;
|
||||||
use App\Form\Model\BookingDto;
|
use App\Form\Model\BookingDto;
|
||||||
use App\Model\BookingEditSubmissionResult;
|
|
||||||
use App\Htmx\HxTrait;
|
use App\Htmx\HxTrait;
|
||||||
|
use App\Model\BookingEditSubmissionResult;
|
||||||
use App\Service\BookingChangeTracker;
|
use App\Service\BookingChangeTracker;
|
||||||
use App\Service\BookingEditContextFactory;
|
use App\Service\BookingEditContextFactory;
|
||||||
use App\Service\BookingEditDataLoader;
|
use App\Service\BookingEditDataLoader;
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ class ParticipantController extends AbstractController
|
|||||||
$context = $this->editContextFactory->createParticipantContext($bookingDto, $bookingData);
|
$context = $this->editContextFactory->createParticipantContext($bookingDto, $bookingData);
|
||||||
|
|
||||||
return $this->render('booking/edit/participant.html.twig', [
|
return $this->render('booking/edit/participant.html.twig', [
|
||||||
'form' => $form->createView(),
|
'form' => $form,
|
||||||
'participantIndex' => $index,
|
'participantIndex' => $index,
|
||||||
'bookingEditContext' => $context,
|
'bookingEditContext' => $context,
|
||||||
'bookingDto' => $context->bookingDto,
|
'bookingDto' => $context->bookingDto,
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ class RegistrationController extends AbstractController
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $this->render('registration/index.html.twig', [
|
return $this->render('registration/index.html.twig', [
|
||||||
'form' => $form->createView(),
|
'form' => $form,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ class ResetPasswordController extends AbstractController
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $this->render('reset_password/index.html.twig', [
|
return $this->render('reset_password/index.html.twig', [
|
||||||
'form' => $form->createView(),
|
'form' => $form,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ final class MailjetNewsletterWebhookController extends AbstractController
|
|||||||
* into a list before dispatching.
|
* into a list before dispatching.
|
||||||
*
|
*
|
||||||
* @param array<int|string, mixed> $payload
|
* @param array<int|string, mixed> $payload
|
||||||
|
*
|
||||||
* @return list<array<string, mixed>>
|
* @return list<array<string, mixed>>
|
||||||
*/
|
*/
|
||||||
private function normalizeEvents(array $payload): array
|
private function normalizeEvents(array $payload): array
|
||||||
|
|||||||
@@ -15,10 +15,10 @@ class BookingSummaryDto
|
|||||||
* @param array<int, RoomSelectionDto> $selectedRooms Selected room DTOs from booking
|
* @param array<int, RoomSelectionDto> $selectedRooms Selected room DTOs from booking
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
public readonly array $selectedRooms,
|
public readonly array $selectedRooms,
|
||||||
public readonly int $participantCount,
|
public readonly int $participantCount,
|
||||||
public readonly BookingSummaryPricingDto $pricing,
|
public readonly BookingSummaryPricingDto $pricing,
|
||||||
public readonly BookingSummaryVoucherDto $vouchers,
|
public readonly BookingSummaryVoucherDto $vouchers,
|
||||||
public readonly ?BookingSummaryCmsHotelData $cmsData,
|
public readonly ?BookingSummaryCmsHotelData $cmsData,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Form\Service\Condition;
|
namespace App\Form\Service\Condition;
|
||||||
|
|
||||||
use App\BusProNet\Model\Service;
|
|
||||||
use App\Form\Model\BookingDto;
|
use App\Form\Model\BookingDto;
|
||||||
use App\Form\Service\Contract\FieldConditionInterface;
|
use App\Form\Service\Contract\FieldConditionInterface;
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||||||
namespace App\Form\Service;
|
namespace App\Form\Service;
|
||||||
|
|
||||||
use App\Form\Model\BookingDto;
|
use App\Form\Model\BookingDto;
|
||||||
|
use App\Form\Model\ParticipantDto;
|
||||||
use App\Form\Service\Abstract\AbstractParticipantFieldHandler;
|
use App\Form\Service\Abstract\AbstractParticipantFieldHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -217,7 +218,7 @@ class ParticipantAssignedRoomFieldHandler extends AbstractParticipantFieldHandle
|
|||||||
* @param BookingDto $bookingDto The booking DTO with all participants
|
* @param BookingDto $bookingDto The booking DTO with all participants
|
||||||
* @param int $excludeParticipantIndex Participant index to exclude from results
|
* @param int $excludeParticipantIndex Participant index to exclude from results
|
||||||
*
|
*
|
||||||
* @return array<int, \App\Form\Model\ParticipantDto> Array of participants indexed by their position
|
* @return array<int, ParticipantDto> Array of participants indexed by their position
|
||||||
*/
|
*/
|
||||||
private function getParticipantsAssignedToRoom(int $roomId, BookingDto $bookingDto, int $excludeParticipantIndex): array
|
private function getParticipantsAssignedToRoom(int $roomId, BookingDto $bookingDto, int $excludeParticipantIndex): array
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ class NewsletterSubscriptionRequestResult
|
|||||||
public const LIST_STATE_SUCCESS = 'success';
|
public const LIST_STATE_SUCCESS = 'success';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param list<int> $listIds
|
* @param list<int> $listIds
|
||||||
* @param array<int, string> $listStates
|
* @param array<int, string> $listStates
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ namespace App\Repository;
|
|||||||
use App\Entity\BookingEditDraft;
|
use App\Entity\BookingEditDraft;
|
||||||
use App\Entity\User;
|
use App\Entity\User;
|
||||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||||
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
|
use Doctrine\ORM\Query\Parameter;
|
||||||
use Doctrine\Persistence\ManagerRegistry;
|
use Doctrine\Persistence\ManagerRegistry;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -47,8 +49,10 @@ class BookingEditDraftRepository extends ServiceEntityRepository
|
|||||||
->delete()
|
->delete()
|
||||||
->where('d.user = :user')
|
->where('d.user = :user')
|
||||||
->andWhere('d.bookingId = :bookingId')
|
->andWhere('d.bookingId = :bookingId')
|
||||||
->setParameter('user', $user)
|
->setParameters(new ArrayCollection([
|
||||||
->setParameter('bookingId', $bookingId)
|
new Parameter('user', $user),
|
||||||
|
new Parameter('bookingId', $bookingId),
|
||||||
|
]))
|
||||||
->getQuery()
|
->getQuery()
|
||||||
->execute();
|
->execute();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ namespace App\Repository;
|
|||||||
|
|
||||||
use App\Entity\NewsletterOptInRequest;
|
use App\Entity\NewsletterOptInRequest;
|
||||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||||
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
|
use Doctrine\ORM\Query\Parameter;
|
||||||
use Doctrine\Persistence\ManagerRegistry;
|
use Doctrine\Persistence\ManagerRegistry;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -29,8 +31,10 @@ class NewsletterOptInRequestRepository extends ServiceEntityRepository
|
|||||||
->where('c.email = :email')
|
->where('c.email = :email')
|
||||||
->andWhere('c.confirmedAt IS NULL')
|
->andWhere('c.confirmedAt IS NULL')
|
||||||
->andWhere('c.expiresAt > :now')
|
->andWhere('c.expiresAt > :now')
|
||||||
->setParameter('email', mb_strtolower(trim($email)))
|
->setParameters(new ArrayCollection([
|
||||||
->setParameter('now', new \DateTimeImmutable())
|
new Parameter('email', mb_strtolower(trim($email))),
|
||||||
|
new Parameter('now', new \DateTimeImmutable()),
|
||||||
|
]))
|
||||||
->orderBy('c.createdAt', 'DESC')
|
->orderBy('c.createdAt', 'DESC')
|
||||||
->setMaxResults(1)
|
->setMaxResults(1)
|
||||||
->getQuery()
|
->getQuery()
|
||||||
@@ -44,8 +48,10 @@ class NewsletterOptInRequestRepository extends ServiceEntityRepository
|
|||||||
->where('c.email = :email')
|
->where('c.email = :email')
|
||||||
->andWhere('c.confirmedAt IS NULL')
|
->andWhere('c.confirmedAt IS NULL')
|
||||||
->andWhere('c.expiresAt <= :now')
|
->andWhere('c.expiresAt <= :now')
|
||||||
->setParameter('email', mb_strtolower(trim($email)))
|
->setParameters(new ArrayCollection([
|
||||||
->setParameter('now', new \DateTimeImmutable())
|
new Parameter('email', mb_strtolower(trim($email))),
|
||||||
|
new Parameter('now', new \DateTimeImmutable()),
|
||||||
|
]))
|
||||||
->getQuery()
|
->getQuery()
|
||||||
->execute();
|
->execute();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ namespace App\Repository;
|
|||||||
|
|
||||||
use App\Entity\TravelSnapshot;
|
use App\Entity\TravelSnapshot;
|
||||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||||
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
|
use Doctrine\ORM\Query\Parameter;
|
||||||
use Doctrine\Persistence\ManagerRegistry;
|
use Doctrine\Persistence\ManagerRegistry;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -102,8 +104,10 @@ class TravelSnapshotRepository extends ServiceEntityRepository
|
|||||||
->where('s.dateTo IS NULL OR s.dateTo >= :dateToThreshold')
|
->where('s.dateTo IS NULL OR s.dateTo >= :dateToThreshold')
|
||||||
// extendedRefreshedAt IS NULL: never-refreshed snapshots rank as oldest.
|
// extendedRefreshedAt IS NULL: never-refreshed snapshots rank as oldest.
|
||||||
->andWhere('s.extendedRefreshedAt IS NULL OR s.extendedRefreshedAt < :refreshBefore')
|
->andWhere('s.extendedRefreshedAt IS NULL OR s.extendedRefreshedAt < :refreshBefore')
|
||||||
->setParameter('dateToThreshold', $dateToThreshold)
|
->setParameters(new ArrayCollection([
|
||||||
->setParameter('refreshBefore', $refreshBefore)
|
new Parameter('dateToThreshold', $dateToThreshold),
|
||||||
|
new Parameter('refreshBefore', $refreshBefore),
|
||||||
|
]))
|
||||||
->orderBy('s.extendedRefreshedAt', 'ASC')
|
->orderBy('s.extendedRefreshedAt', 'ASC')
|
||||||
->addOrderBy('s.id', 'ASC')
|
->addOrderBy('s.id', 'ASC')
|
||||||
->setMaxResults($limit)
|
->setMaxResults($limit)
|
||||||
@@ -148,8 +152,10 @@ class TravelSnapshotRepository extends ServiceEntityRepository
|
|||||||
->where('s.dateFrom IS NOT NULL')
|
->where('s.dateFrom IS NOT NULL')
|
||||||
->andWhere('s.dateFrom > :today')
|
->andWhere('s.dateFrom > :today')
|
||||||
->andWhere('s.dateId NOT IN (:activeXmlDateIds)')
|
->andWhere('s.dateId NOT IN (:activeXmlDateIds)')
|
||||||
->setParameter('today', $today)
|
->setParameters(new ArrayCollection([
|
||||||
->setParameter('activeXmlDateIds', $activeXmlDateIds)
|
new Parameter('today', $today),
|
||||||
|
new Parameter('activeXmlDateIds', $activeXmlDateIds),
|
||||||
|
]))
|
||||||
->getQuery()
|
->getQuery()
|
||||||
->execute();
|
->execute();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class BookingConfigurator
|
|||||||
private readonly ParticipantEligibilityChecker $participantEligibilityService,
|
private readonly ParticipantEligibilityChecker $participantEligibilityService,
|
||||||
private readonly BookingStatusRuleRegistry $bookingStatusRuleRegistry,
|
private readonly BookingStatusRuleRegistry $bookingStatusRuleRegistry,
|
||||||
private readonly AgencyLoader $agencyLoader,
|
private readonly AgencyLoader $agencyLoader,
|
||||||
#[Autowire('%default_booking_status%')]
|
#[Autowire(param: 'default_booking_status')]
|
||||||
private readonly string $defaultBookingStatus,
|
private readonly string $defaultBookingStatus,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Service;
|
namespace App\Service;
|
||||||
|
|
||||||
|
use App\BusProNet\Model\Address;
|
||||||
use App\BusProNet\Model\Service;
|
use App\BusProNet\Model\Service;
|
||||||
use App\BusProNet\Model\Travel;
|
use App\BusProNet\Model\Travel;
|
||||||
use App\Form\Model\BookingDto;
|
use App\Form\Model\BookingDto;
|
||||||
@@ -120,7 +121,7 @@ class BookingEditDraftMerger
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (null === $participant->address) {
|
if (null === $participant->address) {
|
||||||
$participant->address = new \App\BusProNet\Model\Address();
|
$participant->address = new Address();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (true === array_key_exists('street', $data)) {
|
if (true === array_key_exists('street', $data)) {
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ use App\BusProNet\Exception\ApiClientException;
|
|||||||
use App\BusProNet\Exception\TimeoutException;
|
use App\BusProNet\Exception\TimeoutException;
|
||||||
use App\BusProNet\Model\Notification;
|
use App\BusProNet\Model\Notification;
|
||||||
use App\Entity\User;
|
use App\Entity\User;
|
||||||
use App\Model\BookingEditSubmissionResult;
|
|
||||||
use App\Form\Model\BookingDto;
|
use App\Form\Model\BookingDto;
|
||||||
|
use App\Model\BookingEditSubmissionResult;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
|
||||||
@@ -76,6 +76,7 @@ class BookingEditSubmitter
|
|||||||
'booking_id' => $bookingId,
|
'booking_id' => $bookingId,
|
||||||
'message' => $response->message,
|
'message' => $response->message,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return new BookingEditSubmissionResult(
|
return new BookingEditSubmissionResult(
|
||||||
true === $response->isError()
|
true === $response->isError()
|
||||||
? BookingEditSubmissionResult::STATUS_NOTIFICATION_ERROR
|
? BookingEditSubmissionResult::STATUS_NOTIFICATION_ERROR
|
||||||
@@ -118,6 +119,7 @@ class BookingEditSubmitter
|
|||||||
'email' => $email,
|
'email' => $email,
|
||||||
'booking_id' => $bookingId,
|
'booking_id' => $bookingId,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return new BookingEditSubmissionResult(
|
return new BookingEditSubmissionResult(
|
||||||
BookingEditSubmissionResult::STATUS_TIMEOUT,
|
BookingEditSubmissionResult::STATUS_TIMEOUT,
|
||||||
null,
|
null,
|
||||||
|
|||||||
@@ -4,8 +4,12 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Service;
|
namespace App\Service;
|
||||||
|
|
||||||
|
use App\BusProNet\Model\Travel;
|
||||||
use App\Entity\BookingEditDraft;
|
use App\Entity\BookingEditDraft;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
|
||||||
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Style\Fill;
|
||||||
|
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
||||||
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
|
||||||
use Symfony\Component\HttpFoundation\StreamedResponse;
|
use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||||
|
|
||||||
@@ -106,11 +110,11 @@ class BookingExporter
|
|||||||
/**
|
/**
|
||||||
* Builds lookup arrays for converting IDs to labels.
|
* Builds lookup arrays for converting IDs to labels.
|
||||||
*
|
*
|
||||||
* @param \App\BusProNet\Model\Travel $travel The travel data
|
* @param Travel $travel The travel data
|
||||||
*
|
*
|
||||||
* @return array{services: array<int, string>, rooms: array<int, string>, pickups: array<int, string>}
|
* @return array{services: array<int, string>, rooms: array<int, string>, pickups: array<int, string>}
|
||||||
*/
|
*/
|
||||||
private function buildLookups(\App\BusProNet\Model\Travel $travel): array
|
private function buildLookups(Travel $travel): array
|
||||||
{
|
{
|
||||||
$services = [];
|
$services = [];
|
||||||
$rooms = [];
|
$rooms = [];
|
||||||
@@ -174,11 +178,11 @@ class BookingExporter
|
|||||||
$headerStyle = [
|
$headerStyle = [
|
||||||
'font' => ['bold' => true],
|
'font' => ['bold' => true],
|
||||||
'fill' => [
|
'fill' => [
|
||||||
'fillType' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID,
|
'fillType' => Fill::FILL_SOLID,
|
||||||
'startColor' => ['rgb' => 'E0E0E0'],
|
'startColor' => ['rgb' => 'E0E0E0'],
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
$lastColumn = \PhpOffice\PhpSpreadsheet\Cell\Coordinate::stringFromColumnIndex(count(self::COLUMN_HEADERS));
|
$lastColumn = Coordinate::stringFromColumnIndex(count(self::COLUMN_HEADERS));
|
||||||
$sheet->getStyle('A1:'.$lastColumn.'1')->applyFromArray($headerStyle);
|
$sheet->getStyle('A1:'.$lastColumn.'1')->applyFromArray($headerStyle);
|
||||||
|
|
||||||
// Write participant data
|
// Write participant data
|
||||||
@@ -193,7 +197,7 @@ class BookingExporter
|
|||||||
|
|
||||||
// Auto-size columns
|
// Auto-size columns
|
||||||
foreach (range(1, count(self::COLUMN_HEADERS)) as $col) {
|
foreach (range(1, count(self::COLUMN_HEADERS)) as $col) {
|
||||||
$colLetter = \PhpOffice\PhpSpreadsheet\Cell\Coordinate::stringFromColumnIndex($col);
|
$colLetter = Coordinate::stringFromColumnIndex($col);
|
||||||
$sheet->getColumnDimension($colLetter)->setAutoSize(true);
|
$sheet->getColumnDimension($colLetter)->setAutoSize(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -208,7 +212,7 @@ class BookingExporter
|
|||||||
* @param array<string, array<int, string>> $lookups
|
* @param array<string, array<int, string>> $lookups
|
||||||
*/
|
*/
|
||||||
private function writeParticipantRow(
|
private function writeParticipantRow(
|
||||||
\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $sheet,
|
Worksheet $sheet,
|
||||||
int $row,
|
int $row,
|
||||||
array $participant,
|
array $participant,
|
||||||
array $lookups,
|
array $lookups,
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Service;
|
namespace App\Service;
|
||||||
|
|
||||||
|
use App\BusProNet\XmlLoader\TravelLoader;
|
||||||
use App\Model\BpnXmlSnapshotRefreshPlan;
|
use App\Model\BpnXmlSnapshotRefreshPlan;
|
||||||
use App\Model\BpnXmlSnapshotRefreshResult;
|
use App\Model\BpnXmlSnapshotRefreshResult;
|
||||||
use App\BusProNet\XmlLoader\TravelLoader;
|
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
final class BpnXmlSnapshotRefreshManager
|
final class BpnXmlSnapshotRefreshManager
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ use App\Exception\NewsletterListNotAllowedException;
|
|||||||
use App\Exception\NewsletterProviderException;
|
use App\Exception\NewsletterProviderException;
|
||||||
use App\Model\NewsletterConfirmationResult;
|
use App\Model\NewsletterConfirmationResult;
|
||||||
use App\Model\NewsletterSubscriptionRequestResult;
|
use App\Model\NewsletterSubscriptionRequestResult;
|
||||||
use App\Repository\NewsletterOptInRequestRepository;
|
|
||||||
use App\Repository\NewsletterConsentRepository;
|
use App\Repository\NewsletterConsentRepository;
|
||||||
|
use App\Repository\NewsletterOptInRequestRepository;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
@@ -72,7 +72,7 @@ class NewsletterManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param list<int|string> $mailjetListIds
|
* @param list<int|string> $mailjetListIds
|
||||||
* @param list<int|string>|null $knownMailjetListIds
|
* @param list<int|string>|null $knownMailjetListIds
|
||||||
*/
|
*/
|
||||||
public function requestApiSubscription(string $email, array $mailjetListIds, ?array $knownMailjetListIds = null, ?string $firstName = null, ?string $lastName = null): NewsletterSubscriptionRequestResult
|
public function requestApiSubscription(string $email, array $mailjetListIds, ?array $knownMailjetListIds = null, ?string $firstName = null, ?string $lastName = null): NewsletterSubscriptionRequestResult
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ declare(strict_types=1);
|
|||||||
namespace App\Service;
|
namespace App\Service;
|
||||||
|
|
||||||
use App\BusProNet\Model\Insurance;
|
use App\BusProNet\Model\Insurance;
|
||||||
use App\BusProNet\Model\Service;
|
|
||||||
use App\Form\Model\BookingDto;
|
use App\Form\Model\BookingDto;
|
||||||
use App\Form\Model\ParticipantDto;
|
use App\Form\Model\ParticipantDto;
|
||||||
|
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ class ErrorCodeExtension extends AbstractExtension
|
|||||||
public function getFunctions(): array
|
public function getFunctions(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
new TwigFunction('error_code', [$this, 'getErrorCode']),
|
new TwigFunction('error_code', $this->getErrorCode(...)),
|
||||||
new TwigFunction('has_error_code', [$this, 'hasErrorCode']),
|
new TwigFunction('has_error_code', $this->hasErrorCode(...)),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Tests\BusProNet\Service;
|
namespace App\Tests\BusProNet\Service;
|
||||||
|
|
||||||
|
use App\BusProNet\Model\Travel;
|
||||||
use App\BusProNet\Service\BookingStatusRuleRegistry;
|
use App\BusProNet\Service\BookingStatusRuleRegistry;
|
||||||
use App\BusProNet\Service\Contract\BookingStatusRuleInterface;
|
use App\BusProNet\Service\Contract\BookingStatusRuleInterface;
|
||||||
use App\Form\Model\BookingDto;
|
use App\Form\Model\BookingDto;
|
||||||
@@ -98,9 +99,9 @@ class BookingStatusRuleRegistryTest extends TestCase
|
|||||||
$this->assertSame('L', $registry->evaluateStatus($bookingDto));
|
$this->assertSame('L', $registry->evaluateStatus($bookingDto));
|
||||||
}
|
}
|
||||||
|
|
||||||
private function createMockTravel(): \App\BusProNet\Model\Travel
|
private function createMockTravel(): Travel
|
||||||
{
|
{
|
||||||
$travel = new \App\BusProNet\Model\Travel();
|
$travel = new Travel();
|
||||||
$travel->id = 1;
|
$travel->id = 1;
|
||||||
$travel->hotelId = 1;
|
$travel->hotelId = 1;
|
||||||
$travel->dateFrom = new \DateTimeImmutable('2030-01-01');
|
$travel->dateFrom = new \DateTimeImmutable('2030-01-01');
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ use Doctrine\ORM\EntityManagerInterface;
|
|||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
use Symfony\Component\Form\FormInterface;
|
use Symfony\Component\Form\FormInterface;
|
||||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||||
|
|||||||
@@ -4,6 +4,11 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Tests\Form\Model;
|
namespace App\Tests\Form\Model;
|
||||||
|
|
||||||
|
use App\BusProNet\Model\Booking;
|
||||||
|
use App\BusProNet\Model\Address;
|
||||||
|
use App\Form\Model\AddressDto;
|
||||||
|
use App\BusProNet\Model\Service;
|
||||||
|
use App\BusProNet\Model\Insurance;
|
||||||
use App\BusProNet\Model\Travel;
|
use App\BusProNet\Model\Travel;
|
||||||
use App\BusProNet\XmlLoader\AgencyLoader;
|
use App\BusProNet\XmlLoader\AgencyLoader;
|
||||||
use App\Form\Model\BookingDto;
|
use App\Form\Model\BookingDto;
|
||||||
@@ -314,7 +319,7 @@ class ParticipantEditDtoTest extends TestCase
|
|||||||
$bookingDto = new BookingDto($travel, 1); // hotelId must be int
|
$bookingDto = new BookingDto($travel, 1); // hotelId must be int
|
||||||
|
|
||||||
// Create mock booking to simulate edit mode
|
// Create mock booking to simulate edit mode
|
||||||
$mockBooking = new \App\BusProNet\Model\Booking();
|
$mockBooking = new Booking();
|
||||||
$bookingDto->booking = $mockBooking;
|
$bookingDto->booking = $mockBooking;
|
||||||
|
|
||||||
// Create valid participants with all required fields for strict validation
|
// Create valid participants with all required fields for strict validation
|
||||||
@@ -322,7 +327,7 @@ class ParticipantEditDtoTest extends TestCase
|
|||||||
$participant1->index = 0;
|
$participant1->index = 0;
|
||||||
$participant1->mutable = false; // Immutable - strict validation applies
|
$participant1->mutable = false; // Immutable - strict validation applies
|
||||||
$participant1->mobile = '+49 123 456789'; // Required for applicant
|
$participant1->mobile = '+49 123 456789'; // Required for applicant
|
||||||
$participant1->address = new \App\BusProNet\Model\Address();
|
$participant1->address = new Address();
|
||||||
$participant1->address->street = 'Test Street 1';
|
$participant1->address->street = 'Test Street 1';
|
||||||
$participant1->address->postCode = '12345';
|
$participant1->address->postCode = '12345';
|
||||||
$participant1->address->city = 'Test City';
|
$participant1->address->city = 'Test City';
|
||||||
@@ -489,7 +494,7 @@ class ParticipantEditDtoTest extends TestCase
|
|||||||
$participant->dateOfBirth = $travel->dateFrom->modify('-2 years');
|
$participant->dateOfBirth = $travel->dateFrom->modify('-2 years');
|
||||||
$participant->index = 0;
|
$participant->index = 0;
|
||||||
$participant->mobile = '+49 123 456789';
|
$participant->mobile = '+49 123 456789';
|
||||||
$participant->address = new \App\BusProNet\Model\Address();
|
$participant->address = new Address();
|
||||||
$participant->address->street = 'Test Street 1';
|
$participant->address->street = 'Test Street 1';
|
||||||
$participant->address->postCode = '12345';
|
$participant->address->postCode = '12345';
|
||||||
$participant->address->city = 'Test City';
|
$participant->address->city = 'Test City';
|
||||||
@@ -526,7 +531,7 @@ class ParticipantEditDtoTest extends TestCase
|
|||||||
$participant->dateOfBirth = $travel->dateFrom->modify('-3 years');
|
$participant->dateOfBirth = $travel->dateFrom->modify('-3 years');
|
||||||
$participant->index = 0;
|
$participant->index = 0;
|
||||||
$participant->mobile = '+49 123 456789';
|
$participant->mobile = '+49 123 456789';
|
||||||
$participant->address = new \App\BusProNet\Model\Address();
|
$participant->address = new Address();
|
||||||
$participant->address->street = 'Test Street 1';
|
$participant->address->street = 'Test Street 1';
|
||||||
$participant->address->postCode = '12345';
|
$participant->address->postCode = '12345';
|
||||||
$participant->address->city = 'Test City';
|
$participant->address->city = 'Test City';
|
||||||
@@ -559,7 +564,7 @@ class ParticipantEditDtoTest extends TestCase
|
|||||||
$bookingDto = new BookingDto($travel, 1);
|
$bookingDto = new BookingDto($travel, 1);
|
||||||
|
|
||||||
// Create mock booking to simulate edit mode
|
// Create mock booking to simulate edit mode
|
||||||
$mockBooking = new \App\BusProNet\Model\Booking();
|
$mockBooking = new Booking();
|
||||||
$bookingDto->booking = $mockBooking;
|
$bookingDto->booking = $mockBooking;
|
||||||
|
|
||||||
// Create adult participant without ski pass in edit mode
|
// Create adult participant without ski pass in edit mode
|
||||||
@@ -568,7 +573,7 @@ class ParticipantEditDtoTest extends TestCase
|
|||||||
$participant->index = 0;
|
$participant->index = 0;
|
||||||
$participant->mutable = false;
|
$participant->mutable = false;
|
||||||
$participant->mobile = '+49 123 456789';
|
$participant->mobile = '+49 123 456789';
|
||||||
$participant->address = new \App\BusProNet\Model\Address();
|
$participant->address = new Address();
|
||||||
$participant->address->street = 'Test Street 1';
|
$participant->address->street = 'Test Street 1';
|
||||||
$participant->address->postCode = '12345';
|
$participant->address->postCode = '12345';
|
||||||
$participant->address->city = 'Test City';
|
$participant->address->city = 'Test City';
|
||||||
@@ -606,7 +611,7 @@ class ParticipantEditDtoTest extends TestCase
|
|||||||
$participant->dateOfBirth = new \DateTimeImmutable('2023-06-02');
|
$participant->dateOfBirth = new \DateTimeImmutable('2023-06-02');
|
||||||
$participant->index = 0;
|
$participant->index = 0;
|
||||||
$participant->mobile = '+49 123 456789';
|
$participant->mobile = '+49 123 456789';
|
||||||
$participant->address = new \App\BusProNet\Model\Address();
|
$participant->address = new Address();
|
||||||
$participant->address->street = 'Test Street 1';
|
$participant->address->street = 'Test Street 1';
|
||||||
$participant->address->postCode = '12345';
|
$participant->address->postCode = '12345';
|
||||||
$participant->address->city = 'Test City';
|
$participant->address->city = 'Test City';
|
||||||
@@ -647,7 +652,7 @@ class ParticipantEditDtoTest extends TestCase
|
|||||||
$participant->mobile = '+49 123 456789';
|
$participant->mobile = '+49 123 456789';
|
||||||
|
|
||||||
if (null === $participant->address) {
|
if (null === $participant->address) {
|
||||||
$participant->address = new \App\Form\Model\AddressDto();
|
$participant->address = new AddressDto();
|
||||||
}
|
}
|
||||||
$participant->address->street = 'Test Street 1';
|
$participant->address->street = 'Test Street 1';
|
||||||
$participant->address->postCode = '12345';
|
$participant->address->postCode = '12345';
|
||||||
@@ -712,9 +717,9 @@ class ParticipantEditDtoTest extends TestCase
|
|||||||
return $participant;
|
return $participant;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function createMockService(): \App\BusProNet\Model\Service
|
private function createMockService(): Service
|
||||||
{
|
{
|
||||||
$service = new \App\BusProNet\Model\Service();
|
$service = new Service();
|
||||||
$service->id = 1;
|
$service->id = 1;
|
||||||
$service->label = 'Test Service';
|
$service->label = 'Test Service';
|
||||||
$service->subType = 'TEST';
|
$service->subType = 'TEST';
|
||||||
@@ -723,9 +728,9 @@ class ParticipantEditDtoTest extends TestCase
|
|||||||
return $service;
|
return $service;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function createMockInsurance(): \App\BusProNet\Model\Insurance
|
private function createMockInsurance(): Insurance
|
||||||
{
|
{
|
||||||
$insurance = new \App\BusProNet\Model\Insurance();
|
$insurance = new Insurance();
|
||||||
$insurance->id = '1';
|
$insurance->id = '1';
|
||||||
$insurance->label = 'Test Insurance';
|
$insurance->label = 'Test Insurance';
|
||||||
$insurance->price = 10.0;
|
$insurance->price = 10.0;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Tests\Model;
|
namespace App\Tests\Model;
|
||||||
|
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
use App\Model\NewsletterSubscriptionRequest;
|
use App\Model\NewsletterSubscriptionRequest;
|
||||||
use Symfony\Component\Validator\Constraint;
|
use Symfony\Component\Validator\Constraint;
|
||||||
use Symfony\Component\Validator\ConstraintValidatorFactory;
|
use Symfony\Component\Validator\ConstraintValidatorFactory;
|
||||||
@@ -13,7 +14,7 @@ use Symfony\Component\Validator\Constraints\EmailValidator;
|
|||||||
use Symfony\Component\Validator\Validation;
|
use Symfony\Component\Validator\Validation;
|
||||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||||
|
|
||||||
class NewsletterSubscriptionRequestTest extends \PHPUnit\Framework\TestCase
|
class NewsletterSubscriptionRequestTest extends TestCase
|
||||||
{
|
{
|
||||||
public function testValidRequestPassesValidation(): void
|
public function testValidRequestPassesValidation(): void
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Tests\Service;
|
namespace App\Tests\Service;
|
||||||
|
|
||||||
|
use App\Form\Model\BookingDto;
|
||||||
|
use App\Form\Model\ParticipantDto;
|
||||||
use App\BusProNet\Constants;
|
use App\BusProNet\Constants;
|
||||||
use App\BusProNet\Model\Room;
|
use App\BusProNet\Model\Room;
|
||||||
use App\BusProNet\Model\Service;
|
use App\BusProNet\Model\Service;
|
||||||
@@ -192,9 +194,9 @@ class BookingConfiguratorStatusTest extends TestCase
|
|||||||
$travel->dateFrom = new \DateTimeImmutable('2030-01-01');
|
$travel->dateFrom = new \DateTimeImmutable('2030-01-01');
|
||||||
$travel->dateTo = new \DateTimeImmutable('2030-01-06');
|
$travel->dateTo = new \DateTimeImmutable('2030-01-06');
|
||||||
|
|
||||||
$bookingDto = new \App\Form\Model\BookingDto($travel, 456);
|
$bookingDto = new BookingDto($travel, 456);
|
||||||
$bookingDto->bookingStatus = 'F';
|
$bookingDto->bookingStatus = 'F';
|
||||||
$participant = new \App\Form\Model\ParticipantDto();
|
$participant = new ParticipantDto();
|
||||||
$participant->additionalServices = [new Service()];
|
$participant->additionalServices = [new Service()];
|
||||||
$bookingDto->participants = [$participant];
|
$bookingDto->participants = [$participant];
|
||||||
|
|
||||||
@@ -223,7 +225,7 @@ class BookingConfiguratorStatusTest extends TestCase
|
|||||||
$travel->dateFrom = new \DateTimeImmutable('2030-01-01');
|
$travel->dateFrom = new \DateTimeImmutable('2030-01-01');
|
||||||
$travel->dateTo = new \DateTimeImmutable('2030-01-06');
|
$travel->dateTo = new \DateTimeImmutable('2030-01-06');
|
||||||
|
|
||||||
$bookingDto = new \App\Form\Model\BookingDto($travel, 456);
|
$bookingDto = new BookingDto($travel, 456);
|
||||||
$bookingDto->bookingStatus = 'A';
|
$bookingDto->bookingStatus = 'A';
|
||||||
|
|
||||||
$bookingService->applyCreateBookingStatusRules($bookingDto);
|
$bookingService->applyCreateBookingStatusRules($bookingDto);
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Tests\Service;
|
namespace App\Tests\Service;
|
||||||
|
|
||||||
|
use App\BusProNet\ApiClient;
|
||||||
use App\BusProNet\Exception\ApiClientException;
|
use App\BusProNet\Exception\ApiClientException;
|
||||||
use App\BusProNet\Exception\TimeoutException;
|
use App\BusProNet\Exception\TimeoutException;
|
||||||
use App\BusProNet\Model\Booking;
|
use App\BusProNet\Model\Booking;
|
||||||
@@ -87,7 +88,7 @@ class BookingEditSubmitterTest extends TestCase
|
|||||||
->with($bookingDto, $freshBookingData)
|
->with($bookingDto, $freshBookingData)
|
||||||
->willReturn(false);
|
->willReturn(false);
|
||||||
|
|
||||||
$apiClient = $this->createMock(\App\BusProNet\ApiClient::class);
|
$apiClient = $this->createMock(ApiClient::class);
|
||||||
$apiClient->expects($this->once())
|
$apiClient->expects($this->once())
|
||||||
->method('updateBooking')
|
->method('updateBooking')
|
||||||
->with($bookingDto, true)
|
->with($bookingDto, true)
|
||||||
@@ -137,7 +138,7 @@ class BookingEditSubmitterTest extends TestCase
|
|||||||
->with($bookingDto, $freshBookingData)
|
->with($bookingDto, $freshBookingData)
|
||||||
->willReturn(false);
|
->willReturn(false);
|
||||||
|
|
||||||
$apiClient = $this->createMock(\App\BusProNet\ApiClient::class);
|
$apiClient = $this->createMock(ApiClient::class);
|
||||||
$bookingUpdate = new BookingUpdate();
|
$bookingUpdate = new BookingUpdate();
|
||||||
$bookingUpdate->success = false;
|
$bookingUpdate->success = false;
|
||||||
$bookingUpdate->status = 'BPN-FAIL';
|
$bookingUpdate->status = 'BPN-FAIL';
|
||||||
@@ -200,7 +201,7 @@ class BookingEditSubmitterTest extends TestCase
|
|||||||
->with($bookingDto, $freshBookingData)
|
->with($bookingDto, $freshBookingData)
|
||||||
->willReturn(false);
|
->willReturn(false);
|
||||||
|
|
||||||
$apiClient = $this->createMock(\App\BusProNet\ApiClient::class);
|
$apiClient = $this->createMock(ApiClient::class);
|
||||||
$bookingUpdate = new BookingUpdate();
|
$bookingUpdate = new BookingUpdate();
|
||||||
$bookingUpdate->success = true;
|
$bookingUpdate->success = true;
|
||||||
$apiClient->expects($this->once())
|
$apiClient->expects($this->once())
|
||||||
@@ -266,7 +267,7 @@ class BookingEditSubmitterTest extends TestCase
|
|||||||
->with($bookingDto, $freshBookingData)
|
->with($bookingDto, $freshBookingData)
|
||||||
->willReturn(true);
|
->willReturn(true);
|
||||||
|
|
||||||
$apiClient = $this->createMock(\App\BusProNet\ApiClient::class);
|
$apiClient = $this->createMock(ApiClient::class);
|
||||||
$bookingUpdate = new BookingUpdate();
|
$bookingUpdate = new BookingUpdate();
|
||||||
$bookingUpdate->success = true;
|
$bookingUpdate->success = true;
|
||||||
$apiClient->expects($this->once())
|
$apiClient->expects($this->once())
|
||||||
@@ -350,7 +351,7 @@ class BookingEditSubmitterTest extends TestCase
|
|||||||
->with($bookingDto, $freshBookingData)
|
->with($bookingDto, $freshBookingData)
|
||||||
->willReturn(false);
|
->willReturn(false);
|
||||||
|
|
||||||
$apiClient = $this->createMock(\App\BusProNet\ApiClient::class);
|
$apiClient = $this->createMock(ApiClient::class);
|
||||||
$apiClient->expects($this->once())
|
$apiClient->expects($this->once())
|
||||||
->method('updateBooking')
|
->method('updateBooking')
|
||||||
->with($bookingDto, true)
|
->with($bookingDto, true)
|
||||||
@@ -400,7 +401,7 @@ class BookingEditSubmitterTest extends TestCase
|
|||||||
->with($bookingDto, $freshBookingData)
|
->with($bookingDto, $freshBookingData)
|
||||||
->willReturn(false);
|
->willReturn(false);
|
||||||
|
|
||||||
$apiClient = $this->createMock(\App\BusProNet\ApiClient::class);
|
$apiClient = $this->createMock(ApiClient::class);
|
||||||
$apiClient->expects($this->once())
|
$apiClient->expects($this->once())
|
||||||
->method('updateBooking')
|
->method('updateBooking')
|
||||||
->with($bookingDto, true)
|
->with($bookingDto, true)
|
||||||
@@ -421,7 +422,7 @@ class BookingEditSubmitterTest extends TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function createService(
|
private function createService(
|
||||||
?\App\BusProNet\ApiClient $apiClient = null,
|
?ApiClient $apiClient = null,
|
||||||
?BookingEditDataLoader $dataLoader = null,
|
?BookingEditDataLoader $dataLoader = null,
|
||||||
?BookingEditDraftManager $draftService = null,
|
?BookingEditDraftManager $draftService = null,
|
||||||
?TravelDataProvider $travelDataService = null,
|
?TravelDataProvider $travelDataService = null,
|
||||||
@@ -429,7 +430,7 @@ class BookingEditSubmitterTest extends TestCase
|
|||||||
?BookingSessionManager $bookingSessionService = null,
|
?BookingSessionManager $bookingSessionService = null,
|
||||||
): BookingEditSubmitter {
|
): BookingEditSubmitter {
|
||||||
return new BookingEditSubmitter(
|
return new BookingEditSubmitter(
|
||||||
$apiClient ?? $this->createMock(\App\BusProNet\ApiClient::class),
|
$apiClient ?? $this->createMock(ApiClient::class),
|
||||||
$dataLoader ?? $this->createMock(BookingEditDataLoader::class),
|
$dataLoader ?? $this->createMock(BookingEditDataLoader::class),
|
||||||
$draftService ?? $this->createMock(BookingEditDraftManager::class),
|
$draftService ?? $this->createMock(BookingEditDraftManager::class),
|
||||||
$travelDataService ?? $this->createMock(TravelDataProvider::class),
|
$travelDataService ?? $this->createMock(TravelDataProvider::class),
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace App\Tests\Service;
|
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\Room;
|
||||||
use App\BusProNet\Model\Travel;
|
use App\BusProNet\Model\Travel;
|
||||||
use App\Form\Model\BookingDto;
|
use App\Form\Model\BookingDto;
|
||||||
@@ -384,7 +387,7 @@ class ParticipantCardAssemblerTest extends TestCase
|
|||||||
->willReturn([450.50]);
|
->willReturn([450.50]);
|
||||||
|
|
||||||
// Mock validator to return no violations (valid)
|
// Mock validator to return no violations (valid)
|
||||||
$violations = $this->createMock(\Symfony\Component\Validator\ConstraintViolationListInterface::class);
|
$violations = $this->createMock(ConstraintViolationListInterface::class);
|
||||||
$violations->expects($this->once())
|
$violations->expects($this->once())
|
||||||
->method('count')
|
->method('count')
|
||||||
->willReturn(0);
|
->willReturn(0);
|
||||||
@@ -422,13 +425,13 @@ class ParticipantCardAssemblerTest extends TestCase
|
|||||||
->willReturn([0.0]);
|
->willReturn([0.0]);
|
||||||
|
|
||||||
// Mock validator to return violations (invalid)
|
// Mock validator to return violations (invalid)
|
||||||
$violation = $this->createMock(\Symfony\Component\Validator\ConstraintViolationInterface::class);
|
$violation = $this->createMock(ConstraintViolationInterface::class);
|
||||||
$violation->expects($this->once())
|
$violation->expects($this->once())
|
||||||
->method('getMessage')
|
->method('getMessage')
|
||||||
->willReturn('Diese E-Mail Adresse wird bereits von einem anderen Teilnehmer verwendet');
|
->willReturn('Diese E-Mail Adresse wird bereits von einem anderen Teilnehmer verwendet');
|
||||||
|
|
||||||
// Use ConstraintViolationList directly instead of mocking
|
// Use ConstraintViolationList directly instead of mocking
|
||||||
$violations = new \Symfony\Component\Validator\ConstraintViolationList([$violation]);
|
$violations = new ConstraintViolationList([$violation]);
|
||||||
|
|
||||||
$this->validator
|
$this->validator
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
@@ -473,7 +476,7 @@ class ParticipantCardAssemblerTest extends TestCase
|
|||||||
->willReturn([450.0, 500.0]);
|
->willReturn([450.0, 500.0]);
|
||||||
|
|
||||||
// Mock validator to return no violations for both participants
|
// 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))
|
$violations->expects($this->exactly(2))
|
||||||
->method('count')
|
->method('count')
|
||||||
->willReturn(0);
|
->willReturn(0);
|
||||||
|
|||||||
Reference in New Issue
Block a user