Skip to content

Open-source event management and ticket selling platform — perfect for concerts, conferences, and everything in between 🎟️ If you find this project helpful, please consider giving us a star ⭐️

fix tests

Dave Earley8b383700e4eb
diff --git a/backend/app/Services/Handlers/Event/GetPublicEventHandler.php b/backend/app/Services/Handlers/Event/GetPublicEventHandler.php
index 13ee99d99..888f6c922 100644
--- a/backend/app/Services/Handlers/Event/GetPublicEventHandler.php
+++ b/backend/app/Services/Handlers/Event/GetPublicEventHandler.php
@@ -17,13 +17,13 @@ use HiEvents\Services\Domain\Event\EventPageViewIncrementService;
use HiEvents\Services\Domain\Ticket\TicketFilterService;
use HiEvents\Services\Handlers\Event\DTO\GetPublicEventDTO;
-readonly class GetPublicEventHandler
+class GetPublicEventHandler
{
public function __construct(
- private EventRepositoryInterface $eventRepository,
- private PromoCodeRepositoryInterface $promoCodeRepository,
- private TicketFilterService $ticketFilterService,
- private EventPageViewIncrementService $eventPageViewIncrementService,
+ private readonly EventRepositoryInterface $eventRepository,
+ private readonly PromoCodeRepositoryInterface $promoCodeRepository,
+ private readonly TicketFilterService $ticketFilterService,
+ private readonly EventPageViewIncrementService $eventPageViewIncrementService,
)
{
}
diff --git a/backend/tests/Unit/Services/Handlers/Event/GetPublicEventHandlerTest.php b/backend/tests/Unit/Services/Handlers/Event/GetPublicEventHandlerTest.php
index 2ceb332f3..a96224f20 100644
--- a/backend/tests/Unit/Services/Handlers/Event/GetPublicEventHandlerTest.php
+++ b/backend/tests/Unit/Services/Handlers/Event/GetPublicEventHandlerTest.php
@@ -41,12 +41,14 @@ class GetPublicEventHandlerTest extends TestCase
public function testHandleWithoutPromoCodeAndUnauthenticatedUser(): void
{
$data = new GetPublicEventDTO(eventId: 1, isAuthenticated: false, ipAddress: '127.0.0.1', promoCode: null);
+ $tickets = collect();
$event = m::mock(EventDomainObject::class);
$event->shouldReceive('setTickets')->once()->andReturnSelf();
+ $event->shouldReceive('getTickets')->once()->andReturn($tickets);
$this->setupEventRepositoryMock($event, $data->eventId);
$this->promoCodeRepository->shouldReceive('findFirstWhere')->once()->andReturnNull();
- $this->ticketFilterService->shouldReceive('filter')->once()->with($event, null)->andReturn(collect());
+ $this->ticketFilterService->shouldReceive('filter')->once()->with($tickets, null)->andReturn(collect());
$this->eventPageViewIncrementService->shouldReceive('increment')->once()->with($data->eventId, $data->ipAddress);
$this->handler->handle($data);
@@ -56,13 +58,15 @@ class GetPublicEventHandlerTest extends TestCase
{
$data = new GetPublicEventDTO(eventId: 1, isAuthenticated: false, ipAddress: '127.0.0.1', promoCode: 'INVALID');
$event = m::mock(EventDomainObject::class);
+ $tickets = collect();
$event->shouldReceive('setTickets')->once()->andReturnSelf();
+ $event->shouldReceive('getTickets')->once()->andReturn($tickets);
$promoCode = m::mock(PromoCodeDomainObject::class)->makePartial();
$promoCode->shouldReceive('isValid')->andReturn(false);
$this->setupEventRepositoryMock($event, $data->eventId);
$this->promoCodeRepository->shouldReceive('findFirstWhere')->once()->andReturn($promoCode);
- $this->ticketFilterService->shouldReceive('filter')->once()->with($event, null)->andReturn(collect());
+ $this->ticketFilterService->shouldReceive('filter')->once()->with($tickets, null)->andReturn(collect());
$this->eventPageViewIncrementService->shouldReceive('increment')->once()->with($data->eventId, $data->ipAddress);
$this->handler->handle($data);
@@ -71,14 +75,16 @@ class GetPublicEventHandlerTest extends TestCase
public function testHandleWithValidPromoCode(): void
{
$data = new GetPublicEventDTO(eventId: 1, isAuthenticated: false, ipAddress: '127.0.0.1', promoCode: 'VALID');
+ $tickets = collect();
$event = m::mock(EventDomainObject::class);
$event->shouldReceive('setTickets')->once()->andReturnSelf();
+ $event->shouldReceive('getTickets')->once()->andReturn($tickets);
$promoCode = m::mock(PromoCodeDomainObject::class)->makePartial();
$promoCode->shouldReceive('isValid')->andReturn(true);
$this->setupEventRepositoryMock($event, $data->eventId);
$this->promoCodeRepository->shouldReceive('findFirstWhere')->once()->andReturn($promoCode);
- $this->ticketFilterService->shouldReceive('filter')->once()->with($event, $promoCode)->andReturn(collect());
+ $this->ticketFilterService->shouldReceive('filter')->once()->with($tickets, $promoCode)->andReturn(collect());
$this->eventPageViewIncrementService->shouldReceive('increment')->once()->with($data->eventId, $data->ipAddress);
$this->handler->handle($data);
diff --git a/frontend/scripts/list_untranslated_string.sh b/frontend/scripts/list_untranslated_string.sh
index 502556725..bf8cc08fc 100755
--- a/frontend/scripts/list_untranslated_string.sh
+++ b/frontend/scripts/list_untranslated_string.sh
@@ -1,13 +1,13 @@
#!/bin/bash
-# Define the path to your single PO file
+# This script lists all untranslated strings in a .po file.
+
+# arbitrary translation file
poFile="../src/locales/es.po"
-# Check if the file exists
if [ -f "$poFile" ]; then
echo "Checking file: $poFile"
- # Use awk to parse the PO file and find untranslated terms
awk '
BEGIN { RS=""; FS="\n" }
{