Skip to content

Commit

Permalink
Merge pull request #15021 from snipe/fixes/removed_non_counts
Browse files Browse the repository at this point in the history
Removed non-counts from allowed array
  • Loading branch information
snipe authored Jul 3, 2024
2 parents ca57f6d + 5e15cc3 commit f22c3cd
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
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);
}
}
}

0 comments on commit f22c3cd

Please sign in to comment.