Skip to content

Commit

Permalink
chore: added test coverage for whereNotIn
Browse files Browse the repository at this point in the history
  • Loading branch information
patoui committed Dec 1, 2024
1 parent f00c122 commit 60a660b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ Below is a list of currently untested methods or functionality. This does not me
- `whereJsonLength`
- `whereBetween`
- `whereNotBetween`
- `whereNotIn`
- `whereDate`, `whereMonth`, `whereDay`, `whereYear`, `whereTime`
- `orWhereColumn`
- `whereExists`
Expand Down
19 changes: 19 additions & 0 deletions tests/Feature/ModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,25 @@ public function test_where_in(): void
self::assertSame($accepted, $analytics[1]->status);
}

public function test_where_not_in(): void
{
// Arrange
$ok = 200;
$created = 201;
$accepted = 202;
Analytic::create(['ts' => time(), 'analytic_id' => mt_rand(1000, 9999), 'status' => $ok, 'name' => 'not_null', 'label' => 'Page View']);
Analytic::create(['ts' => time(), 'analytic_id' => mt_rand(1000, 9999), 'status' => $created, 'name' => 'not_null', 'label' => 'Page View']);
Analytic::create(['ts' => time(), 'analytic_id' => mt_rand(1000, 9999), 'status' => $accepted, 'name' => 'not_null', 'label' => 'Page View']);

// Act & Assert
$analyticsQuery = Analytic::whereNotIn('status', [$ok, $accepted]);
self::assertSame(
1,
$analyticsQuery->count(),
);
self::assertSame($created, $analyticsQuery->first()->status);
}

public function test_multiple_where(): void
{
// Arrange
Expand Down

0 comments on commit 60a660b

Please sign in to comment.