fix tests

This commit is contained in:
Pig Fang 2021-05-02 11:35:28 +08:00
parent 332b8cf7ef
commit 14fd06a11f
No known key found for this signature in database
GPG Key ID: A8198F548DADA9E2
2 changed files with 6 additions and 4 deletions

View File

@ -6,6 +6,7 @@ use App\Models\Texture;
use App\Models\User; use App\Models\User;
use Illuminate\Foundation\Testing\DatabaseTransactions; use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Support\Facades\Event; use Illuminate\Support\Facades\Event;
use Laravel\Passport\Passport;
class ClosetManagementControllerTest extends TestCase class ClosetManagementControllerTest extends TestCase
{ {
@ -23,8 +24,8 @@ class ClosetManagementControllerTest extends TestCase
$admin = User::factory()->admin()->create(); $admin = User::factory()->admin()->create();
$admin->closet()->attach($texture->tid); $admin->closet()->attach($texture->tid);
$this->actingAs($admin, 'oauth') Passport::actingAs($admin, ['ClosetManagement.Read'], 'oauth');
->getJson('/api/admin/closet/'.$admin->uid) $this->getJson('/api/admin/closet/'.$admin->uid)
->assertJson([['tid' => $texture->tid]]); ->assertJson([['tid' => $texture->tid]]);
} }

View File

@ -5,6 +5,7 @@ namespace Tests;
use App\Models\User; use App\Models\User;
use App\Notifications; use App\Notifications;
use Illuminate\Support\Facades\Notification; use Illuminate\Support\Facades\Notification;
use Laravel\Passport\Passport;
use League\CommonMark\GithubFlavoredMarkdownConverter; use League\CommonMark\GithubFlavoredMarkdownConverter;
class NotificationsControllerTest extends TestCase class NotificationsControllerTest extends TestCase
@ -100,8 +101,8 @@ class NotificationsControllerTest extends TestCase
$id = $user->unreadNotifications->first()->id; $id = $user->unreadNotifications->first()->id;
$this->actingAs($user, 'oauth') Passport::actingAs($user, ['Notification.Read'], 'oauth');
->getJson('/api/user/notifications') $this->getJson('/api/user/notifications')
->assertJson([['id' => $id, 'title' => 'title']]); ->assertJson([['id' => $id, 'title' => 'title']]);
} }