Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
iamgergo committed Jul 3, 2022
1 parent da23046 commit 0f19fc1
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion tests/Models/MediumTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,26 @@ public function a_medium_has_path()
}

/** @test */
public function a_medium_has_query_scopes()
public function a_medium_has_search_query_scope()
{
$query = Medium::query()->search('test');

$this->assertSame(
'select * from "root_media" where "root_media"."name" like ?',
$query->toSql()
);

$this->assertSame(['%test%'], $query->getBindings());

$this->assertSame(
'select * from "root_media"',
Medium::query()->search()->toSql()
);
}

/** @test */
public function a_medium_has_type_query_scope()
{
$query = Medium::query()->type('file');
$this->assertSame(
'select * from "root_media" where "root_media"."mime_type" not like ?',
Expand All @@ -72,5 +83,10 @@ public function a_medium_has_query_scopes()
$query->toSql()
);
$this->assertSame(['image%'], $query->getBindings());

$this->assertSame(
'select * from "root_media"',
Medium::query()->type('test')->toSql()
);
}
}

0 comments on commit 0f19fc1

Please sign in to comment.