Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
DenTray authored Dec 12, 2024
1 parent e3fb6d3 commit 14b5bad
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
9 changes: 5 additions & 4 deletions tests/ValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,11 @@ public function testListExistsIfDuplicateValues()
{
$this->mockListExists([1, 2, 3]);

$validator = Validator::make(
['ids' => [1, 2, 3, 3]],
['ids' => 'list_exists:clients,user_id'],
);
$validator = Validator::make([
'ids' => [1, 2, 3, 3],
] [
'ids' => 'list_exists:clients,user_id',
]);

$this->assertTrue($validator->passes());
}
Expand Down
6 changes: 2 additions & 4 deletions tests/support/Traits/SqlMockTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -436,12 +436,10 @@ protected function mockListExists(
string $table = 'clients',
string $keyField = 'user_id',
): void {
$countResult = [[ 'aggregate' => count($result) ]];

$this->mockSelect(
query: "select count(distinct \"{$keyField}\") as aggregate from \"{$table}\" where \"{$keyField}\" in (?, ?, ?)",
result: $countResult,
bindings: [1, 2, 3],
result: [[ 'aggregate' => count($result) ]],
bindings: $result,
);
}

Expand Down

0 comments on commit 14b5bad

Please sign in to comment.