mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-26 22:19:41 -08:00
Scaffold tests for user select list api and begin to implemenet
This commit is contained in:
parent
b92d1d3ec7
commit
a2e47d19fc
50
tests/Feature/Api/Users/UsersForSelectListTest.php
Normal file
50
tests/Feature/Api/Users/UsersForSelectListTest.php
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tests\Feature\Api\Users;
|
||||||
|
|
||||||
|
use App\Models\Setting;
|
||||||
|
use App\Models\User;
|
||||||
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||||
|
use Illuminate\Testing\Fluent\AssertableJson;
|
||||||
|
use Laravel\Passport\Passport;
|
||||||
|
use Tests\TestCase;
|
||||||
|
|
||||||
|
class UsersForSelectListTest extends TestCase
|
||||||
|
{
|
||||||
|
use RefreshDatabase;
|
||||||
|
|
||||||
|
public function testUsersAreReturned()
|
||||||
|
{
|
||||||
|
Setting::factory()->create();
|
||||||
|
|
||||||
|
$actor = User::factory()->firstAdmin()->create();
|
||||||
|
User::factory()->count(3)->create();
|
||||||
|
|
||||||
|
Passport::actingAs($actor);
|
||||||
|
$response = $this->getJson(route('api.users.selectlist'));
|
||||||
|
$response->assertOk();
|
||||||
|
|
||||||
|
$response->assertJsonStructure([
|
||||||
|
'results',
|
||||||
|
'pagination',
|
||||||
|
'total_count',
|
||||||
|
'page',
|
||||||
|
'page_count',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$response->assertJson(fn(AssertableJson $json) => $json->has('results', 4)->etc());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testUsersScopedToCompanyWhenMultipleFullCompanySupportEnabled()
|
||||||
|
{
|
||||||
|
$this->markTestIncomplete();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testUsersScopedToCompanyDuringSearchWhenMultipleFullCompanySupportEnabled()
|
||||||
|
{
|
||||||
|
$this->markTestIncomplete();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue