Files
saasshop/tests/Feature/AdminAccessTest.php

56 lines
1.6 KiB
PHP

<?php
namespace Tests\Feature;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class AdminAccessTest extends TestCase
{
use RefreshDatabase;
public function test_admin_login_page_displays_new_console_naming(): void
{
$response = $this->get('/admin/login');
$response->assertOk();
$response->assertSee('总台管理登录');
$response->assertSee('登录总台管理');
}
public function test_platform_admin_can_login_and_open_dashboard_with_new_naming(): void
{
$this->seed();
$response = $this->post('/admin/login', [
'email' => 'platform.admin@demo.local',
'password' => 'Platform@123456',
]);
$response->assertRedirect('/admin');
$dashboard = $this->get('/admin');
$dashboard->assertOk();
$dashboard->assertSee('总台管理');
$dashboard->assertSee('总台仪表盘');
$dashboard->assertSee('站点管理');
$dashboard->assertSee('订单监控');
$dashboard->assertSee('商品巡检');
$dashboard->assertSee('商品分类');
}
public function test_merchant_admin_cannot_login_from_admin_entry(): void
{
$this->seed();
$response = $this->from('/admin/login')->post('/admin/login', [
'email' => 'merchant.admin@demo.local',
'password' => 'Merchant@123456',
]);
$response->assertRedirect('/admin/login');
$this->get('/admin/login')->assertSee('当前账号是商家管理员,请从商家后台入口登录');
}
}