Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed non-counts from allowed array #15021

Merged
merged 3 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions app/Http/Controllers/Api/UsersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,6 @@ public function index(Request $request)
'jobtitle',
'username',
'employee_num',
'assets',
'accessories',
'consumables',
'licenses',
'groups',
'activated',
'created_at',
Expand Down
13 changes: 13 additions & 0 deletions tests/Feature/Users/Api/UserSearchTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,17 @@ public function testUsersScopedToCompanyDuringSearchWhenMultipleFullCompanySuppo
'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();
}
}
7 changes: 7 additions & 0 deletions tests/Support/CanSkipTests.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,11 @@ public function markIncompleteIfMySQL($message = 'Test skipped due to database d
$this->markTestIncomplete($message);
}
}

public function markIncompleteIfSqlite($message = 'Test skipped due to database driver being sqlite.')
{
if (config('database.default') === 'sqlite') {
$this->markTestIncomplete($message);
}
}
}
Loading