feat: install Sanctum, scaffold api.php, add FuelType::fromAlias()
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
28
tests/Unit/Enums/FuelTypeTest.php
Normal file
28
tests/Unit/Enums/FuelTypeTest.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use App\Enums\FuelType;
|
||||
|
||||
it('resolves diesel alias to B7Standard', function () {
|
||||
expect(FuelType::fromAlias('diesel'))->toBe(FuelType::B7Standard);
|
||||
});
|
||||
|
||||
it('resolves petrol alias to E10', function () {
|
||||
expect(FuelType::fromAlias('petrol'))->toBe(FuelType::E10);
|
||||
});
|
||||
|
||||
it('resolves unleaded alias to E10', function () {
|
||||
expect(FuelType::fromAlias('unleaded'))->toBe(FuelType::E10);
|
||||
});
|
||||
|
||||
it('resolves premium_unleaded alias to E5', function () {
|
||||
expect(FuelType::fromAlias('premium_unleaded'))->toBe(FuelType::E5);
|
||||
});
|
||||
|
||||
it('accepts canonical enum values as aliases', function () {
|
||||
expect(FuelType::fromAlias('e10'))->toBe(FuelType::E10);
|
||||
expect(FuelType::fromAlias('b7_standard'))->toBe(FuelType::B7Standard);
|
||||
});
|
||||
|
||||
it('throws ValueError for unknown alias', function () {
|
||||
FuelType::fromAlias('avgas');
|
||||
})->throws(ValueError::class);
|
||||
Reference in New Issue
Block a user