M3: Filament 后台资源(文章/分类/评论/媒体/用户/友链)+ 博客设置页 + 仪表盘统计
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class AdminPagesTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
private User $admin;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->seed();
|
||||
|
||||
$this->admin = User::query()->firstOrCreate(
|
||||
['email' => 'admin@laralog.test'],
|
||||
['name' => '管理员', 'password' => bcrypt('password')]
|
||||
);
|
||||
}
|
||||
|
||||
public function test_dashboard_loads(): void
|
||||
{
|
||||
$this->actingAs($this->admin)->get('/admin')->assertOk();
|
||||
}
|
||||
|
||||
public function test_post_resource_loads(): void
|
||||
{
|
||||
$this->actingAs($this->admin)->get('/admin/posts')->assertOk();
|
||||
$this->actingAs($this->admin)->get('/admin/posts/create')->assertOk();
|
||||
}
|
||||
|
||||
public function test_settings_page_loads(): void
|
||||
{
|
||||
$this->actingAs($this->admin)->get('/admin/blog-settings')->assertOk();
|
||||
}
|
||||
|
||||
public function test_comment_resource_loads(): void
|
||||
{
|
||||
$this->actingAs($this->admin)->get('/admin/comments')->assertOk();
|
||||
}
|
||||
|
||||
public function test_media_resource_loads(): void
|
||||
{
|
||||
$this->actingAs($this->admin)->get('/admin/media')->assertOk();
|
||||
}
|
||||
|
||||
public function test_guest_is_redirected_to_login(): void
|
||||
{
|
||||
$this->get('/admin')->assertRedirect('/admin/login');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user