Skip to content

Commit

Permalink
add minCount and maxCount to ChecksDatabaseQueryCountResult
Browse files Browse the repository at this point in the history
  • Loading branch information
markvaneijk committed May 30, 2023
1 parent cc88a81 commit 6dac0a6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
8 changes: 4 additions & 4 deletions config/ok.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@

'via' => [
// 'discord' => [
// 'channel' => 1111586288131391548,
// 'channel' => 123456790,
// ],
// 'mail' => [
// 'to' => 'hello@example.com',
// ],
'mail' => [
'to' => 'mark@vormkracht10.nl',
],
// 'slack' => [
// 'webhook_url' => 'webhook-url',
// ],
Expand Down
20 changes: 18 additions & 2 deletions src/Checks/Traits/ChecksDatabaseQueryCountResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,27 @@

trait ChecksDatabaseQueryCountResult
{
public int $expectedCount = 0;
public ?int $expectedCount = null;

public ?int $minCount = null;

public ?int $maxCount = null;

public function checkExpectedCount(int $count)
{
return $this->expectedCount === $count;
if (! is_null($this->expectedCount)) {
return $this->expectedCount === $count;
}

if (! is_null($this->minCount)) {
return $count >= $this->minCount;
}

if (! is_null($this->maxCount)) {
return $count <= $this->maxCount;
}

return false;
}

public function run(): Result
Expand Down

0 comments on commit 6dac0a6

Please sign in to comment.