55 lines
1.5 KiB
PHP
55 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature;
|
|
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Tests\TestCase;
|
|
|
|
class SiteAdminAccessTest extends TestCase
|
|
{
|
|
use RefreshDatabase;
|
|
|
|
public function test_site_admin_login_page_is_accessible(): void
|
|
{
|
|
$response = $this->get('/site-admin/login');
|
|
|
|
$response->assertOk();
|
|
$response->assertSee('站点后台登录');
|
|
$response->assertSee('登录站点后台');
|
|
}
|
|
|
|
public function test_site_admin_can_login_and_open_dashboard(): void
|
|
{
|
|
$this->seed();
|
|
|
|
$response = $this->post('/site-admin/login', [
|
|
'email' => 'merchant.admin@demo.local',
|
|
'password' => 'Merchant@123456',
|
|
]);
|
|
|
|
$response->assertRedirect('/site-admin');
|
|
|
|
$dashboard = $this->get('/site-admin');
|
|
$dashboard->assertOk();
|
|
$dashboard->assertSee('站点后台仪表盘');
|
|
$dashboard->assertSee('站点仪表盘');
|
|
$dashboard->assertSee('站点商品');
|
|
$dashboard->assertSee('站点订单');
|
|
$dashboard->assertSee('站点商家');
|
|
}
|
|
|
|
public function test_platform_admin_cannot_login_from_site_admin_entry(): void
|
|
{
|
|
$this->seed();
|
|
|
|
$response = $this->from('/site-admin/login')->post('/site-admin/login', [
|
|
'email' => 'platform.admin@demo.local',
|
|
'password' => 'Platform@123456',
|
|
]);
|
|
|
|
$response->assertRedirect('/site-admin/login');
|
|
|
|
$this->get('/site-admin/login')->assertSee('当前账号不是站点管理员,不能登录站点后台');
|
|
}
|
|
}
|