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