first commit
This commit is contained in:
40
tests/Identity/AdminHomePathTest.php
Normal file
40
tests/Identity/AdminHomePathTest.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Identity;
|
||||
|
||||
use Netig\Netslim\Identity\UI\Http\AdminHomePath;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
final class AdminHomePathTest extends TestCase
|
||||
{
|
||||
private ?string $previous = null;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->previous = $_ENV['ADMIN_HOME_PATH'] ?? null;
|
||||
unset($_ENV['ADMIN_HOME_PATH']);
|
||||
}
|
||||
|
||||
protected function tearDown(): void
|
||||
{
|
||||
if ($this->previous === null) {
|
||||
unset($_ENV['ADMIN_HOME_PATH']);
|
||||
} else {
|
||||
$_ENV['ADMIN_HOME_PATH'] = $this->previous;
|
||||
}
|
||||
}
|
||||
|
||||
public function testResolveDefaultsToGenericAdminPath(): void
|
||||
{
|
||||
self::assertSame('/admin', AdminHomePath::resolve());
|
||||
}
|
||||
|
||||
public function testResolveNormalizesConfiguredPath(): void
|
||||
{
|
||||
$_ENV['ADMIN_HOME_PATH'] = 'admin/posts';
|
||||
|
||||
self::assertSame('/admin/posts', AdminHomePath::resolve());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user