diff --git a/tests/Feature/Api/Departments/DepartmentsIndexTest.php b/tests/Feature/Api/Departments/DepartmentsIndexTest.php deleted file mode 100644 index 1067ec74c..000000000 --- a/tests/Feature/Api/Departments/DepartmentsIndexTest.php +++ /dev/null @@ -1,64 +0,0 @@ -markTestIncomplete( - 'Waiting for removal of Company::scopeCompanyables in DepartmentsController@index' - ); - - [$companyA, $companyB] = Company::factory()->count(2)->create(); - - $departmentA = Department::factory()->for($companyA)->create(); - $departmentB = Department::factory()->for($companyB)->create(); - - $superUser = $companyA->users()->save(User::factory()->superuser()->make()); - $userInCompanyA = $companyA->users()->save(User::factory()->viewDepartments()->make()); - $userInCompanyB = $companyB->users()->save(User::factory()->viewDepartments()->make()); - - $this->settings->disableMultipleFullCompanySupport(); - - $this->actingAsForApi($superUser) - ->getJson(route('api.departments.index')) - ->assertResponseContainsInRows($departmentA) - ->assertResponseContainsInRows($departmentB); - - $this->actingAsForApi($userInCompanyA) - ->getJson(route('api.departments.index')) - ->assertResponseContainsInRows($departmentA) - ->assertResponseContainsInRows($departmentB); - - $this->actingAsForApi($userInCompanyB) - ->getJson(route('api.departments.index')) - ->assertResponseContainsInRows($departmentA) - ->assertResponseContainsInRows($departmentB); - - $this->settings->enableMultipleFullCompanySupport(); - - $this->actingAsForApi($superUser) - ->getJson(route('api.departments.index')) - ->assertResponseContainsInRows($departmentA) - ->assertResponseContainsInRows($departmentB); - - $this->actingAsForApi($userInCompanyA) - ->getJson(route('api.departments.index')) - ->assertResponseContainsInRows($departmentA) - ->assertResponseDoesNotContainInRows($departmentB); - - $this->actingAsForApi($userInCompanyB) - ->getJson(route('api.departments.index')) - ->assertResponseDoesNotContainInRows($departmentA) - ->assertResponseContainsInRows($departmentB); - } -} diff --git a/tests/Feature/Api/Users/UsersIndexTest.php b/tests/Feature/Api/Users/UsersIndexTest.php deleted file mode 100644 index 644c5e9e0..000000000 --- a/tests/Feature/Api/Users/UsersIndexTest.php +++ /dev/null @@ -1,63 +0,0 @@ -markTestIncomplete( - 'Waiting for removal of Company::scopeCompanyables in UsersController@index' - ); - - [$companyA, $companyB] = Company::factory()->count(2)->create(); - - $userA = User::factory()->for($companyA)->create(); - $userB = User::factory()->for($companyB)->create(); - - $superUser = $companyA->users()->save(User::factory()->superuser()->make()); - $userInCompanyA = $companyA->users()->save(User::factory()->viewUsers()->make()); - $userInCompanyB = $companyB->users()->save(User::factory()->viewUsers()->make()); - - $this->settings->disableMultipleFullCompanySupport(); - - $this->actingAsForApi($superUser) - ->getJson(route('api.users.index')) - ->assertResponseContainsInRows($userA, 'first_name') - ->assertResponseContainsInRows($userB, 'first_name'); - - $this->actingAsForApi($userInCompanyA) - ->getJson(route('api.users.index')) - ->assertResponseContainsInRows($userA, 'first_name') - ->assertResponseContainsInRows($userB, 'first_name'); - - $this->actingAsForApi($userInCompanyB) - ->getJson(route('api.users.index')) - ->assertResponseContainsInRows($userA, 'first_name') - ->assertResponseContainsInRows($userB, 'first_name'); - - $this->settings->enableMultipleFullCompanySupport(); - - $this->actingAsForApi($superUser) - ->getJson(route('api.users.index')) - ->assertResponseContainsInRows($userA, 'first_name') - ->assertResponseContainsInRows($userB, 'first_name'); - - $this->actingAsForApi($userInCompanyA) - ->getJson(route('api.users.index')) - ->assertResponseContainsInRows($userA, 'first_name') - ->assertResponseDoesNotContainInRows($userB, 'first_name'); - - $this->actingAsForApi($userInCompanyB) - ->getJson(route('api.users.index')) - ->assertResponseDoesNotContainInRows($userA, 'first_name') - ->assertResponseContainsInRows($userB, 'first_name'); - } -} diff --git a/tests/Feature/DashboardTest.php b/tests/Feature/DashboardTest.php index 1772eac31..4e9459fb0 100644 --- a/tests/Feature/DashboardTest.php +++ b/tests/Feature/DashboardTest.php @@ -2,7 +2,6 @@ namespace Tests\Feature; -use App\Models\Company; use App\Models\User; use Tests\Support\InteractsWithSettings; use Tests\TestCase; @@ -17,24 +16,4 @@ class DashboardTest extends TestCase ->get(route('home')) ->assertRedirect(route('view-assets')); } - - public function testUserCountIsScopedByCompany() - { - $this->markTestIncomplete( - 'Waiting for removal of Company::scopeCompanyables in DashboardController@index' - ); - - $this->settings->enableMultipleFullCompanySupport(); - - $companyA = Company::factory()->has(User::factory()->count(1))->create(); - Company::factory()->has(User::factory()->count(3))->create(); - - $adminForCompanyA = $companyA->users()->save(User::factory()->admin()->make()); - - $this->actingAs($adminForCompanyA) - ->get(route('home')) - ->assertOk() - ->assertViewIs('dashboard') - ->assertViewHas('counts', fn($counts) => $counts['user'] === $companyA->users->count()); - } }