Files
pricebuddy/tests/Unit/Enums/ApiAbilityTest.php
Jeremy 96c8e8560f feat: API key management with scoped token abilities
Redesign API key creation and enforce scoped abilities on the custom API routes.

- ApiAbility enum and ability enforcement on the custom API routes
- Redesigned API key creation: current user, all/custom permissions, and a
  dedicated one-time token page with a non-HTTPS clipboard fallback
- Restrict custom keys to a known ability allowlist
- Link global search results to the product view page rather than the edit page
2026-06-18 23:13:06 +10:00

27 lines
789 B
PHP

<?php
namespace Tests\Unit\Enums;
use App\Enums\ApiAbility;
use PHPUnit\Framework\TestCase;
class ApiAbilityTest extends TestCase
{
public function test_has_the_custom_route_abilities(): void
{
$this->assertSame('meta-extraction:extract', ApiAbility::MetaExtractionExtract->value);
$this->assertSame('user:detail', ApiAbility::UserDetail->value);
}
public function test_each_case_has_a_label_and_group(): void
{
foreach (ApiAbility::cases() as $case) {
$this->assertNotSame('', $case->label());
$this->assertNotSame('', $case->group());
}
$this->assertSame('Meta extraction', ApiAbility::MetaExtractionExtract->group());
$this->assertSame('Account', ApiAbility::UserDetail->group());
}
}