27 lines
789 B
PHP
27 lines
789 B
PHP
<?php
|
|
|
|
namespace Tests\Unit;
|
|
|
|
use App\Support\AdminFlash;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class AdminFlashSuccessPayloadTest extends TestCase
|
|
{
|
|
public function test_success_should_return_message_only_when_no_link(): void
|
|
{
|
|
$p = AdminFlash::success('ok');
|
|
|
|
$this->assertSame('ok', (string) ($p['success'] ?? ''));
|
|
$this->assertArrayNotHasKey('success_link_href', $p);
|
|
}
|
|
|
|
public function test_success_should_include_link_when_href_present(): void
|
|
{
|
|
$p = AdminFlash::success('ok', '/admin/x', '查看');
|
|
|
|
$this->assertSame('ok', (string) ($p['success'] ?? ''));
|
|
$this->assertSame('/admin/x', (string) ($p['success_link_href'] ?? ''));
|
|
$this->assertSame('查看', (string) ($p['success_link_label'] ?? ''));
|
|
}
|
|
}
|