Skip to content

Commit

Permalink
Fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
LucWollants committed Nov 21, 2024
1 parent 0cbfdcc commit 879ab6b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 28 deletions.
52 changes: 26 additions & 26 deletions tests/Event/EventTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ public function it_keeps_existing_uitpas_prices_on_price_info_update(): void
new PriceInfoUpdated(
'd2b41f1d-598c-46af-a3a5-10e373faa6fe',
(new PriceInfo(Tariff::createBasePrice(new Money(100, new Currency('EUR')))))
->withUiTPASTariffs([
->withUiTPASTariffs(new Tariffs(
new Tariff(
new TranslatedTariffName(
new Language('nl'),
Expand All @@ -666,7 +666,7 @@ public function it_keeps_existing_uitpas_prices_on_price_info_update(): void
new Currency('EUR')
)
),
])
))
),
])
->when(
Expand All @@ -685,7 +685,7 @@ public function it_keeps_existing_uitpas_prices_on_price_info_update(): void
new PriceInfoUpdated(
'd2b41f1d-598c-46af-a3a5-10e373faa6fe',
(new PriceInfo(Tariff::createBasePrice(new Money(90, new Currency('EUR')))))
->withUiTPASTariffs([
->withUiTPASTariffs(new Tariffs(
new Tariff(
new TranslatedTariffName(
new Language('nl'),
Expand All @@ -696,7 +696,7 @@ public function it_keeps_existing_uitpas_prices_on_price_info_update(): void
new Currency('EUR')
)
),
])
))
),
]);
}
Expand All @@ -723,7 +723,7 @@ public function it_ignores_an_update_of_uitpas_prices(): void
new PriceInfoUpdated(
'd2b41f1d-598c-46af-a3a5-10e373faa6fe',
(new PriceInfo(Tariff::createBasePrice(new Money(100, new Currency('EUR')))))
->withUiTPASTariffs([
->withUiTPASTariffs(new Tariffs(
new Tariff(
new TranslatedTariffName(
new Language('nl'),
Expand All @@ -734,7 +734,7 @@ public function it_ignores_an_update_of_uitpas_prices(): void
new Currency('EUR')
)
),
])
))
),
])
->when(
Expand All @@ -746,7 +746,7 @@ public function it_ignores_an_update_of_uitpas_prices(): void
new Currency('EUR')
)
)
))->withUiTPASTariffs([
))->withUiTPASTariffs(new Tariffs(
new Tariff(
new TranslatedTariffName(
new Language('nl'),
Expand All @@ -757,14 +757,14 @@ public function it_ignores_an_update_of_uitpas_prices(): void
new Currency('EUR')
)
),
])
))
)
)
->then([
new PriceInfoUpdated(
'd2b41f1d-598c-46af-a3a5-10e373faa6fe',
(new PriceInfo(Tariff::createBasePrice(new Money(90, new Currency('EUR')))))
->withUiTPASTariffs([
->withUiTPASTariffs(new Tariffs(
new Tariff(
new TranslatedTariffName(
new Language('nl'),
Expand All @@ -775,7 +775,7 @@ public function it_ignores_an_update_of_uitpas_prices(): void
new Currency('EUR')
)
),
])
))
),
]);
}
Expand All @@ -802,7 +802,7 @@ public function it_ignores_an_update_with_equal_prices_without_uitpas(): void
new PriceInfoUpdated(
'd2b41f1d-598c-46af-a3a5-10e373faa6fe',
(new PriceInfo(Tariff::createBasePrice(new Money(100, new Currency('EUR')))))
->withUiTPASTariffs([
->withUiTPASTariffs(new Tariffs(
new Tariff(
new TranslatedTariffName(
new Language('nl'),
Expand All @@ -813,7 +813,7 @@ public function it_ignores_an_update_with_equal_prices_without_uitpas(): void
new Currency('EUR')
)
),
])
))
),
])
->when(
Expand Down Expand Up @@ -853,7 +853,7 @@ public function it_ignores_an_update_with_only_different_uitpas_prices(): void
new PriceInfoUpdated(
'd2b41f1d-598c-46af-a3a5-10e373faa6fe',
(new PriceInfo(Tariff::createBasePrice(new Money(100, new Currency('EUR')))))
->withUiTPASTariffs([
->withUiTPASTariffs(new Tariffs(
new Tariff(
new TranslatedTariffName(
new Language('nl'),
Expand All @@ -864,7 +864,7 @@ public function it_ignores_an_update_with_only_different_uitpas_prices(): void
new Currency('EUR')
)
),
])
))
),
])
->when(
Expand All @@ -877,7 +877,7 @@ public function it_ignores_an_update_with_only_different_uitpas_prices(): void
)
)
)
)->withUiTPASTariffs([
)->withUiTPASTariffs(new Tariffs(
new Tariff(
new TranslatedTariffName(
new Language('nl'),
Expand All @@ -888,7 +888,7 @@ public function it_ignores_an_update_with_only_different_uitpas_prices(): void
new Currency('EUR')
)
),
])
))
)
)
->then([]);
Expand Down Expand Up @@ -945,44 +945,44 @@ public function it_handles_update_price_info_from_udb2_update(): void
->when(
fn (Event $event) => $event->updatePriceInfo(
(new PriceInfo((Tariff::createBasePrice(new Money(1250, new Currency('EUR'))))))
->withTariffs([
->withTariffs(new Tariffs(
new Tariff(
new TranslatedTariffName(
new Language('nl'),
new TariffName('Met kinderen')
),
new Money(2000, new Currency('EUR'))
),
])
))
)
)
->when(
fn (Event $event) => $event->updatePriceInfo(
(new PriceInfo((Tariff::createBasePrice(new Money(1250, new Currency('EUR'))))))
->withTariffs([
->withTariffs(new Tariffs(
new Tariff(
new TranslatedTariffName(
new Language('nl'),
new TariffName('Met kinderen')
),
new Money(1499, new Currency('EUR'))
),
])
))
)
)
->then([
new PriceInfoUpdated(
$eventId,
(new PriceInfo(Tariff::createBasePrice(new Money(1250, new Currency('EUR')))))
->withTariffs([
->withTariffs(new Tariffs(
new Tariff(
new TranslatedTariffName(
new Language('nl'),
new TariffName('Met kinderen')
),
new Money(1499, new Currency('EUR'))
),
])
))
),
]);
}
Expand Down Expand Up @@ -1920,7 +1920,7 @@ public function it_ignores_equal_uitpas_prices(): void
new PriceInfoUpdated(
'd2b41f1d-598c-46af-a3a5-10e373faa6fe',
(new PriceInfo(Tariff::createBasePrice(new Money(100, new Currency('EUR')))))
->withUiTPASTariffs([
->withUiTPASTariffs(new Tariffs(
new Tariff(
new TranslatedTariffName(
new Language('nl'),
Expand All @@ -1941,7 +1941,7 @@ public function it_ignores_equal_uitpas_prices(): void
new Currency('EUR')
)
),
])
))
),
])
->when(
Expand Down Expand Up @@ -2021,7 +2021,7 @@ function (Event $event): void {
new PriceInfoUpdated(
'd2b41f1d-598c-46af-a3a5-10e373faa6fe',
(new PriceInfo(Tariff::createBasePrice(new Money(100, new Currency('EUR')))))
->withUiTPASTariffs([
->withUiTPASTariffs(new Tariffs(
new Tariff(
new TranslatedTariffName(
new Language('nl'),
Expand All @@ -2042,7 +2042,7 @@ function (Event $event): void {
new Currency('EUR')
)
),
])
)),
),
]);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/PriceInfo/PriceInfoTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@ public function it_returns_the_base_price(): void
*/
public function it_returns_any_extra_tariffs(): void
{
$this->assertEquals($this->tariffs, $this->priceInfo->getTariffs());
$this->assertEquals(new Tariffs(...$this->tariffs), $this->priceInfo->getTariffs());
}

/**
* @test
*/
public function it_returns_any_extra_uitpas_tariffs(): void
{
$this->assertEquals($this->uitpasTariffs, $this->priceInfo->getUiTPASTariffs());
$this->assertEquals(new Tariffs(...$this->uitpasTariffs), $this->priceInfo->getUiTPASTariffs());
}

/**
Expand Down

0 comments on commit 879ab6b

Please sign in to comment.