FAIL Tests\Feature\Api\AdminTest ✓ non admin cannot access admin routes 4.60s ✓ admin can view all users 0.08s ✓ admin can view user details 0.05s ✓ admin can manage user roles 0.06s ⨯ admin can suspend user 0.08s ⨯ admin can view all plans 0.03s ⨯ admin can create plan 0.05s ⨯ admin can update plan 0.03s ⨯ admin can manage plan features 0.03s ⨯ admin can view templates 0.03s ✓ admin can create template 0.04s ⨯ admin can view revenue reports 0.04s ⨯ admin can view user reports 0.07s ⨯ admin can view feature usage 0.08s ⨯ staff can manage templates 0.04s ✓ staff cannot manage users 0.06s ✓ staff cannot manage plans 0.05s ──────────────────────────────────────────────────────────────────────────── 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 422. Failed asserting that 422 is identical to 201. The following errors occurred during the last request: { "message": "The selected features.0 is invalid. (and 2 more errors)", "errors": { "features.0": [ "The selected features.0 is invalid." ], "features.1": [ "The selected features.1 is invalid." ], "features.2": [ "The selected features.2 is invalid." ] } } at tests\Feature\Api\AdminTest.php:150 146▕ 'duration_days' => 30, 147▕ 'features' => [1, 2, 3], 148▕ ]); 149▕ ➜ 150▕ $response->assertStatus(201) 151▕ ->assertJsonStructure(['id', 'name', 'description']); 152▕ 153▕ $this->assertDatabaseHas('plans', [ 154▕ '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:235 231▕ $response = $this->actingAs($this->admin) 232▕ ->getJson('/api/admin/reports/revenue?period=month'); 233▕ 234▕ $response->assertStatus(200) ➜ 235▕ ->assertJsonStructure([ 236▕ 'total_revenue', 237▕ 'active_subscriptions', 238▕ 'new_subscriptions', 239▕ '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:253 249▕ 250▕ $response = $this->actingAs($this->admin) 251▕ ->getJson('/api/admin/reports/users?period=month'); 252▕ ➜ 253▕ $response->assertStatus(200) 254▕ ->assertJsonStructure([ 255▕ 'total_users', 256▕ 'new_users', 257▕ '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:269 265▕ { 266▕ $response = $this->actingAs($this->admin) 267▕ ->getJson('/api/admin/reports/features'); 268▕ ➜ 269▕ $response->assertStatus(200) 270▕ ->assertJsonStructure([ 271▕ 'features' => [ 272▕ '*' => [ 273▕ '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:287 283▕ { 284▕ $response = $this->actingAs($this->staff) 285▕ ->getJson('/api/admin/templates'); 286▕ ➜ 287▕ $response->assertStatus(200); 288▕ } 289▕ 290▕ public function test_staff_cannot_manage_users() 291▕ { Tests: 10 failed, 7 passed (79 assertions) Duration: 5.60s