Release 1.0.1: normalized userinfo and callback helper

This commit is contained in:
Andy Dixon
2026-02-26 09:07:11 +00:00
parent 1c7b7b6717
commit 94c85fc8d5
12 changed files with 403 additions and 45 deletions
+33
View File
@@ -0,0 +1,33 @@
<?php
declare(strict_types=1);
namespace BlackWall\Auth\Tests;
use BlackWall\Auth\UserInfoNormalizer;
use BlackWall\Auth\Exception\UserInfoException;
use PHPUnit\Framework\TestCase;
final class UserInfoNormalizerTest extends TestCase
{
public function testNormalizesNestedClaimsAndRoleString(): void
{
$normalized = UserInfoNormalizer::normalize([
'email' => 'User@Example.com',
'claims' => [
'role' => 'admin',
],
]);
self::assertSame('user@example.com', $normalized->email);
self::assertSame(1, $normalized->privilegeLevel);
self::assertSame('admin', $normalized->role);
}
public function testThrowsWhenEmailMissing(): void
{
$this->expectException(UserInfoException::class);
UserInfoNormalizer::normalize(['sub' => '123']);
}
}