FAIL Tests\Feature\Api\AdminTest ✓ non admin cannot access admin routes 3.50s ✓ admin can view all users 0.07s ✓ admin can view user details 0.05s ✓ admin can manage user roles 0.05s ⨯ admin can suspend user 0.06s ⨯ admin can view all plans 0.25s ⨯ admin can create plan 0.13s ⨯ admin can update plan 0.06s ⨯ admin can manage plan features 0.05s ⨯ admin can view templates 0.04s ✓ admin can create template 0.07s ⨯ admin can view revenue reports 0.05s ⨯ admin can view user reports 0.07s ⨯ admin can view feature usage 0.06s ⨯ staff can manage templates 0.03s ✓ staff cannot manage users 0.03s ✓ staff cannot manage plans 0.05s ──────────────────────────────────────────────────────────────────────────── FAILED Tests\Feature\Api\AdminTest > admin can suspend user Failed asserting that null 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 price field must be an integer. (and 4 more errors)", "errors": { "price": [ "The price field must be an integer." ], "duration_days": [ "The duration days field is required." ], "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▕ 'billing_cycle' => 'monthly', 147▕ 'features' => ['qr_codes', 'analytics', 'custom_domain'], 148▕ ]); 149▕ ➜ 150▕ $response->assertStatus(201) 151▕ ->assertJsonStructure(['id', 'name', 'slug']); 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:236 232▕ $response = $this->actingAs($this->admin) 233▕ ->getJson('/api/admin/reports/revenue?period=month'); 234▕ 235▕ $response->assertStatus(200) ➜ 236▕ ->assertJsonStructure([ 237▕ 'total_revenue', 238▕ 'active_subscriptions', 239▕ 'new_subscriptions', 240▕ '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:254 250▕ 251▕ $response = $this->actingAs($this->admin) 252▕ ->getJson('/api/admin/reports/users?period=month'); 253▕ ➜ 254▕ $response->assertStatus(200) 255▕ ->assertJsonStructure([ 256▕ 'total_users', 257▕ 'new_users', 258▕ '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:270 266▕ { 267▕ $response = $this->actingAs($this->admin) 268▕ ->getJson('/api/admin/reports/features'); 269▕ ➜ 270▕ $response->assertStatus(200) 271▕ ->assertJsonStructure([ 272▕ 'features' => [ 273▕ '*' => [ 274▕ '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:288 284▕ { 285▕ $response = $this->actingAs($this->staff) 286▕ ->getJson('/api/admin/templates'); 287▕ ➜ 288▕ $response->assertStatus(200); 289▕ } 290▕ 291▕ public function test_staff_cannot_manage_users() 292▕ { Tests: 10 failed, 7 passed (79 assertions) Duration: 4.75s