24 lines
687 B
PHP
24 lines
687 B
PHP
<?php
|
|
|
|
namespace Tests\Unit;
|
|
|
|
use App\Services\Auth\ApiLoginSecurityService;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class ApiLoginSecurityServiceTest extends TestCase
|
|
{
|
|
public function test_roles_object_map_matches_codeigniter_encoding(): void
|
|
{
|
|
$service = new ApiLoginSecurityService();
|
|
$map = $service->rolesToObjectMap(['Teacher', 'Admin']);
|
|
|
|
$this->assertTrue($map->Teacher);
|
|
$this->assertTrue($map->Admin);
|
|
|
|
$payload = json_encode(['roles' => $map]);
|
|
$this->assertIsString($payload);
|
|
$this->assertStringContainsString('"Teacher":true', $payload);
|
|
$this->assertStringContainsString('"Admin":true', $payload);
|
|
}
|
|
}
|