FAIL Tests\Feature\Api\AdminTest ✓ non admin cannot access admin routes 3.29s ✓ admin can view all users 0.07s ✓ admin can view user details 0.05s ✓ admin can manage user roles 0.04s ⨯ admin can suspend user 0.04s ⨯ admin can view all plans 0.04s ⨯ admin can create plan 0.08s ⨯ admin can update plan 0.02s ⨯ admin can manage plan features 0.02s ⨯ admin can view templates 0.02s ✓ admin can create template 0.03s ⨯ admin can view revenue reports 0.04s ⨯ admin can view user reports 0.05s ⨯ admin can view feature usage 0.05s ⨯ staff can manage templates 0.05s ✓ staff cannot manage users 0.05s ✓ staff cannot manage plans 0.04s ──────────────────────────────────────────────────────────────────────────── FAILED Tests\Feature\Api\AdminTest > admin can suspend user Failed asserting that 0 is true. at tests\Feature\Api\AdminTest.php:113 109▕ 110▕ $response->assertStatus(200); 111▕ 112▕ $testUser->refresh(); ➜ 113▕ $this->assertTrue($testUser->is_suspended); 114▕ } 115▕ 116▕ public function test_admin_can_view_all_plans() 117▕ { 1 tests\Feature\Api\AdminTest.php:113 ──────────────────────────────────────────────────────────────────────────── FAILED Tests\Feature\Api\AdminTest > admin can v… BadMethodCallException Call to undefined method App\Models\Plan::factory() at vendor\laravel\framework\src\Illuminate\Support\Traits\ForwardsCalls.php:67 63▕ * @throws \BadMethodCallException 64▕ */ 65▕ protected static function throwBadMethodCallException($method) 66▕ { ➜ 67▕ throw new BadMethodCallException(sprintf( 68▕ 'Call to undefined method %s::%s()', static::class, $method 69▕ )); 70▕ } 71▕ } 1 vendor\laravel\framework\src\Illuminate\Support\Traits\ForwardsCalls.php:67 2 vendor\laravel\framework\src\Illuminate\Support\Traits\ForwardsCalls.php:36 ──────────────────────────────────────────────────────────────────────────── FAILED Tests\Feature\Api\AdminTest > admin can create plan Expected response status code [201] but received 500. Failed asserting that 500 is identical to 201. at tests\Feature\Api\AdminTest.php:149 145▕ 'billing_cycle' => 'monthly', 146▕ 'duration_days' => 30, 147▕ ]); 148▕ ➜ 149▕ $response->assertStatus(201) 150▕ ->assertJsonStructure(['id', 'name', 'description']); 151▕ 152▕ $this->assertDatabaseHas('plans', [ 153▕ 'name' => 'Premium Plus', ──────────────────────────────────────────────────────────────────────────── FAILED Tests\Feature\Api\AdminTest > admin can u… BadMethodCallException Call to undefined method App\Models\Plan::factory() at vendor\laravel\framework\src\Illuminate\Support\Traits\ForwardsCalls.php:67 63▕ * @throws \BadMethodCallException 64▕ */ 65▕ protected static function throwBadMethodCallException($method) 66▕ { ➜ 67▕ throw new BadMethodCallException(sprintf( 68▕ 'Call to undefined method %s::%s()', static::class, $method 69▕ )); 70▕ } 71▕ } 1 vendor\laravel\framework\src\Illuminate\Support\Traits\ForwardsCalls.php:67 2 vendor\laravel\framework\src\Illuminate\Support\Traits\ForwardsCalls.php:36 ──────────────────────────────────────────────────────────────────────────── FAILED Tests\Feature\Api\AdminTest > admin can m… BadMethodCallException Call to undefined method App\Models\Plan::factory() at vendor\laravel\framework\src\Illuminate\Support\Traits\ForwardsCalls.php:67 63▕ * @throws \BadMethodCallException 64▕ */ 65▕ protected static function throwBadMethodCallException($method) 66▕ { ➜ 67▕ throw new BadMethodCallException(sprintf( 68▕ 'Call to undefined method %s::%s()', static::class, $method 69▕ )); 70▕ } 71▕ } 1 vendor\laravel\framework\src\Illuminate\Support\Traits\ForwardsCalls.php:67 2 vendor\laravel\framework\src\Illuminate\Support\Traits\ForwardsCalls.php:36 ──────────────────────────────────────────────────────────────────────────── FAILED Tests\Feature\Api\AdminTest > admin can v… BadMethodCallException Call to undefined method App\Models\Template::factory() at vendor\laravel\framework\src\Illuminate\Support\Traits\ForwardsCalls.php:67 63▕ * @throws \BadMethodCallException 64▕ */ 65▕ protected static function throwBadMethodCallException($method) 66▕ { ➜ 67▕ throw new BadMethodCallException(sprintf( 68▕ 'Call to undefined method %s::%s()', static::class, $method 69▕ )); 70▕ } 71▕ } 1 vendor\laravel\framework\src\Illuminate\Support\Traits\ForwardsCalls.php:67 2 vendor\laravel\framework\src\Illuminate\Support\Traits\ForwardsCalls.php:36 ──────────────────────────────────────────────────────────────────────────── FAILED Tests\Feature\Api\AdminTest > admin can view revenue reports Failed asserting that an array has the key 'total_revenue'. at tests\Feature\Api\AdminTest.php:234 230▕ $response = $this->actingAs($this->admin) 231▕ ->getJson('/api/admin/reports/revenue?period=month'); 232▕ 233▕ $response->assertStatus(200) ➜ 234▕ ->assertJsonStructure([ 235▕ 'total_revenue', 236▕ 'active_subscriptions', 237▕ 'new_subscriptions', 238▕ 'cancelled_subscriptions', ──────────────────────────────────────────────────────────────────────────── FAILED Tests\Feature\Api\AdminTest > admin can view user reports Expected response status code [200] but received 500. Failed asserting that 500 is identical to 200. at tests\Feature\Api\AdminTest.php:252 248▕ 249▕ $response = $this->actingAs($this->admin) 250▕ ->getJson('/api/admin/reports/users?period=month'); 251▕ ➜ 252▕ $response->assertStatus(200) 253▕ ->assertJsonStructure([ 254▕ 'total_users', 255▕ 'new_users', 256▕ 'active_users', ──────────────────────────────────────────────────────────────────────────── FAILED Tests\Feature\Api\AdminTest > admin can view feature usage Expected response status code [200] but received 404. Failed asserting that 404 is identical to 200. at tests\Feature\Api\AdminTest.php:268 264▕ { 265▕ $response = $this->actingAs($this->admin) 266▕ ->getJson('/api/admin/reports/features'); 267▕ ➜ 268▕ $response->assertStatus(200) 269▕ ->assertJsonStructure([ 270▕ 'features' => [ 271▕ '*' => [ 272▕ 'name', ──────────────────────────────────────────────────────────────────────────── FAILED Tests\Feature\Api\AdminTest > staff can manage templates Expected response status code [200] but received 403. Failed asserting that 403 is identical to 200. at tests\Feature\Api\AdminTest.php:286 282▕ { 283▕ $response = $this->actingAs($this->staff) 284▕ ->getJson('/api/admin/templates'); 285▕ ➜ 286▕ $response->assertStatus(200); 287▕ } 288▕ 289▕ public function test_staff_cannot_manage_users() 290▕ { Tests: 10 failed, 7 passed (79 assertions) Duration: 4.14s