Skip to content

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
  • Loading branch information
arif-rh committed Jun 8, 2021
1 parent 2ade56c commit 18f9dee
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions tests/DynaModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -362,15 +362,18 @@ public function testTimestamps():void

public function testFindBy()
{
$posts = DB::table('posts');
$posts = DB::table('posts');
$publishPosts = $posts->findBy(['status' => 'publish']);

$this->assertCount(4, $publishPosts);

$posts = DB::table('posts');
$posts = DB::table('posts');
$publishPosts = $posts->findBy([
'status' => 'publish',
'id' => [1,2]
'id' => [
1,
2,
],
]);

$this->assertCount(2, $publishPosts);
Expand All @@ -394,12 +397,18 @@ public function testDeleteBy()
$posts = DB::table('posts');
$posts->deleteBy([
'status' => 'publish',
'id' => [3,4]
'id' => [
3,
4,
],
]);

$publishPosts = $posts->findBy([
'status' => 'publish',
'id' => [3,4]
'id' => [
3,
4,
],
]);

$this->assertEmpty($publishPosts);
Expand All @@ -411,19 +420,19 @@ public function testSoftDeleteBy()
$posts->useSoftDelete();
$posts->deleteBy([
'status' => 'publish',
'id' => [2]
'id' => [2],
]);

$publishPosts = $posts->findBy([
'status' => 'publish',
'id' => [2]
'id' => [2],
]);

$this->assertEmpty($publishPosts);

$publishPosts = $posts->withDeleted()->findBy([
'status' => 'publish',
'id' => [2]
'id' => [2],
]);

$this->assertCount(1, $publishPosts);
Expand Down

0 comments on commit 18f9dee

Please sign in to comment.