27 lines
587 B
PHP
27 lines
587 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace Tests\Shared;
|
|
|
|
use App\Shared\Http\FlashService;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
final class FlashServiceConsumeTest extends TestCase
|
|
{
|
|
protected function setUp(): void
|
|
{
|
|
$_SESSION = [];
|
|
}
|
|
|
|
public function testGetReturnsNullWhenMissingAndConsumesWhenPresent(): void
|
|
{
|
|
$flash = new FlashService();
|
|
|
|
self::assertNull($flash->get('missing'));
|
|
|
|
$flash->set('notice', 'Bonjour');
|
|
self::assertSame('Bonjour', $flash->get('notice'));
|
|
self::assertNull($flash->get('notice'));
|
|
}
|
|
}
|