mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-12 06:17:28 -08:00
Remove incomplete tests
This commit is contained in:
parent
3cb0920411
commit
7cb22d3d49
|
@ -1,64 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Feature\Api\Departments;
|
||||
|
||||
use App\Models\Company;
|
||||
use App\Models\Department;
|
||||
use App\Models\User;
|
||||
use Tests\Support\InteractsWithSettings;
|
||||
use Tests\TestCase;
|
||||
|
||||
class DepartmentsIndexTest extends TestCase
|
||||
{
|
||||
use InteractsWithSettings;
|
||||
|
||||
public function testDepartmentsIndexAdheresToCompanyScoping()
|
||||
{
|
||||
$this->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);
|
||||
}
|
||||
}
|
|
@ -1,63 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Feature\Api\Users;
|
||||
|
||||
use App\Models\Company;
|
||||
use App\Models\User;
|
||||
use Tests\Support\InteractsWithSettings;
|
||||
use Tests\TestCase;
|
||||
|
||||
class UsersIndexTest extends TestCase
|
||||
{
|
||||
use InteractsWithSettings;
|
||||
|
||||
public function testUsersIndexAdheresToCompanyScoping()
|
||||
{
|
||||
$this->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');
|
||||
}
|
||||
}
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue