create(['role' => 'admin']); $response = $this->actingAs($admin) ->postJson('/api/categories', [ 'name' => 'New Category', 'description' => 'Category Description', ]); $response->assertStatus(200) ->assertJson([ 'message' => 'Category created successfully', ]); $this->assertDatabaseHas('categories', [ 'name' => 'New Category', ]); } public function test_author_cannot_create_category(): void { $author = User::factory()->create(['role' => 'author']); $response = $this->actingAs($author) ->postJson('/api/categories', [ 'name' => 'New Category', 'description' => 'Category Description', ]); $response->assertStatus(403); } }