Merge pull request #15021 from snipe/fixes/removed_non_counts

Removed non-counts from allowed array
This commit is contained in:
snipe 2024-07-03 22:21:17 +01:00 committed by GitHub
commit f22c3cdda9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 20 additions and 4 deletions

View file

@ -247,10 +247,6 @@ class UsersController extends Controller
'jobtitle',
'username',
'employee_num',
'assets',
'accessories',
'consumables',
'licenses',
'groups',
'activated',
'created_at',

View file

@ -144,4 +144,17 @@ class UserSearchTest extends TestCase
'User index contains unexpected user from another company'
);
}
public function testUsersIndexWhenInvalidSortFieldIsPassed()
{
$this->markIncompleteIfSqlite('This test is not compatible with SQLite');
$this->actingAsForApi(User::factory()->viewUsers()->create())
->getJson(route('api.users.index', [
'sort' => 'assets',
]))
->assertOk()
->assertStatus(200)
->json();
}
}

View file

@ -10,4 +10,11 @@ trait CanSkipTests
$this->markTestIncomplete($message);
}
}
public function markIncompleteIfSqlite($message = 'Test skipped due to database driver being sqlite.')
{
if (config('database.default') === 'sqlite') {
$this->markTestIncomplete($message);
}
}
}