mirror of
https://github.com/snipe/snipe-it.git
synced 2025-02-02 08:21:09 -08:00
Inline method call
This commit is contained in:
parent
abaf59c990
commit
0f6051bbe5
|
@ -5,7 +5,6 @@ namespace Tests\Feature\Api\Components;
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
use App\Models\Component;
|
use App\Models\Component;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Illuminate\Testing\TestResponse;
|
|
||||||
use Laravel\Passport\Passport;
|
use Laravel\Passport\Passport;
|
||||||
use Tests\Support\InteractsWithResponses;
|
use Tests\Support\InteractsWithResponses;
|
||||||
use Tests\Support\InteractsWithSettings;
|
use Tests\Support\InteractsWithSettings;
|
||||||
|
@ -30,40 +29,35 @@ class ComponentIndexTest extends TestCase
|
||||||
$this->settings->disableMultipleFullCompanySupport();
|
$this->settings->disableMultipleFullCompanySupport();
|
||||||
|
|
||||||
Passport::actingAs($superUser);
|
Passport::actingAs($superUser);
|
||||||
$response = $this->sendRequest();
|
$response = $this->getJson(route('api.components.index'));
|
||||||
$this->assertResponseContainsInRows($response, $componentA);
|
$this->assertResponseContainsInRows($response, $componentA);
|
||||||
$this->assertResponseContainsInRows($response, $componentB);
|
$this->assertResponseContainsInRows($response, $componentB);
|
||||||
|
|
||||||
Passport::actingAs($userInCompanyA);
|
Passport::actingAs($userInCompanyA);
|
||||||
$response = $this->sendRequest();
|
$response = $this->getJson(route('api.components.index'));
|
||||||
$this->assertResponseContainsInRows($response, $componentA);
|
$this->assertResponseContainsInRows($response, $componentA);
|
||||||
$this->assertResponseContainsInRows($response, $componentB);
|
$this->assertResponseContainsInRows($response, $componentB);
|
||||||
|
|
||||||
Passport::actingAs($userInCompanyB);
|
Passport::actingAs($userInCompanyB);
|
||||||
$response = $this->sendRequest();
|
$response = $this->getJson(route('api.components.index'));
|
||||||
$this->assertResponseContainsInRows($response, $componentA);
|
$this->assertResponseContainsInRows($response, $componentA);
|
||||||
$this->assertResponseContainsInRows($response, $componentB);
|
$this->assertResponseContainsInRows($response, $componentB);
|
||||||
|
|
||||||
$this->settings->enableMultipleFullCompanySupport();
|
$this->settings->enableMultipleFullCompanySupport();
|
||||||
|
|
||||||
Passport::actingAs($superUser);
|
Passport::actingAs($superUser);
|
||||||
$response = $this->sendRequest();
|
$response = $this->getJson(route('api.components.index'));
|
||||||
$this->assertResponseContainsInRows($response, $componentA);
|
$this->assertResponseContainsInRows($response, $componentA);
|
||||||
$this->assertResponseContainsInRows($response, $componentB);
|
$this->assertResponseContainsInRows($response, $componentB);
|
||||||
|
|
||||||
Passport::actingAs($userInCompanyA);
|
Passport::actingAs($userInCompanyA);
|
||||||
$response = $this->sendRequest();
|
$response = $this->getJson(route('api.components.index'));
|
||||||
$this->assertResponseContainsInRows($response, $componentA);
|
$this->assertResponseContainsInRows($response, $componentA);
|
||||||
$this->assertResponseDoesNotContainInRows($response, $componentB);
|
$this->assertResponseDoesNotContainInRows($response, $componentB);
|
||||||
|
|
||||||
Passport::actingAs($userInCompanyB);
|
Passport::actingAs($userInCompanyB);
|
||||||
$response = $this->sendRequest();
|
$response = $this->getJson(route('api.components.index'));
|
||||||
$this->assertResponseDoesNotContainInRows($response, $componentA);
|
$this->assertResponseDoesNotContainInRows($response, $componentA);
|
||||||
$this->assertResponseContainsInRows($response, $componentB);
|
$this->assertResponseContainsInRows($response, $componentB);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function sendRequest(): TestResponse
|
|
||||||
{
|
|
||||||
return $this->getJson(route('api.components.index'));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue