feat: turn search_trips into the website's travel search
This commit is contained in:
1 parent
bfdedefae3
commit
4ab2714bde
12 files changed
+693
-151
No files matched your search
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Tests\Chatbot;
|
||||
|
||||
use App\Chatbot\TravelPeriods;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Clock\MockClock;
|
||||
|
||||
class TravelPeriodsTest extends TestCase
|
||||
{
|
||||
private TravelPeriods $periods;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->periods = new TravelPeriods([
|
||||
['label' => 'Herbst', 'from' => '2026-09-01', 'to' => '2026-10-07'],
|
||||
['label' => 'Silvester', 'from' => '2026-12-26', 'to' => '2027-01-03'],
|
||||
['label' => '1 Januarwoche', 'from' => '2027-01-02', 'to' => '2027-01-09'],
|
||||
], new MockClock('2026-10-08 10:00:00'));
|
||||
}
|
||||
|
||||
public function testFindsACurrentPeriodByLabelIgnoringCase(): void
|
||||
{
|
||||
$range = $this->periods->find(' silvester ');
|
||||
|
||||
self::assertSame('2026-12-26', $range['from']->format('Y-m-d'));
|
||||
self::assertSame('2027-01-03', $range['to']->format('Y-m-d'));
|
||||
}
|
||||
|
||||
public function testAPeriodWhoseEndHasPassedIsNoLongerOffered(): void
|
||||
{
|
||||
self::assertNull($this->periods->find('Herbst'));
|
||||
self::assertSame(['Silvester', '1 Januarwoche'], $this->periods->labels());
|
||||
}
|
||||
|
||||
public function testAnUnknownLabelIsNull(): void
|
||||
{
|
||||
self::assertNull($this->periods->find('Pfingsten'));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user