feat: add bookable flag to product export rooms
This commit is contained in:
1 parent
2b27b9809d
commit
0ff312c0c0
10 files changed
+126
-28
No files matched your search
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Tests\BusProNet\Model;
|
||||
|
||||
use App\BusProNet\Constants;
|
||||
use App\BusProNet\Model\Room;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class RoomTest extends TestCase
|
||||
{
|
||||
#[DataProvider('bookableStateProvider')]
|
||||
public function testIsBookableState(?string $status, ?int $available, bool $expected): void
|
||||
{
|
||||
self::assertSame($expected, Room::isBookableState($status, $available));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return iterable<string, array{?string, ?int, bool}>
|
||||
*/
|
||||
public static function bookableStateProvider(): iterable
|
||||
{
|
||||
yield 'free with rooms left' => [Constants::STATUS_AVAILABLE, 3, true];
|
||||
yield 'free but sold out' => [Constants::STATUS_AVAILABLE, 0, false];
|
||||
yield 'free without a count' => [Constants::STATUS_AVAILABLE, null, false];
|
||||
yield 'on request with rooms left' => [Constants::STATUS_ON_REQUEST, 5, false];
|
||||
yield 'on request and sold out' => [Constants::STATUS_ON_REQUEST, 0, false];
|
||||
yield 'booking stop' => [Constants::STATUS_BLOCKED, 5, false];
|
||||
yield 'no status' => [null, 5, false];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user