Skip to content

Commit bc13deb

Browse files
committed
Improve code coverage
1 parent 48be2df commit bc13deb

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

lib/Relation.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,8 @@ public function includes(): Relation
561561
* ])
562562
* # SELECT * FROM users WHERE name = 'Joe' AND email = 'joe@example.com'
563563
*
564+
* @throws ValidationsArgumentError If you pass in a Relation. Relation::and() supports relations
565+
*
564566
* @return Relation<TModel>
565567
*/
566568
public function where(): Relation

test/RelationTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,12 @@ public function testAnd()
115115
$this->assertEquals('Bill Clinton', $model->name);
116116
}
117117

118+
public function testAndRelationThrowsError()
119+
{
120+
$this->expectException(ValidationsArgumentError::class);
121+
Author::where(Author::where("mixedCaseField = 'Bill'"));
122+
}
123+
118124
public function testReverseOrder()
119125
{
120126
$relation = Author::where(['mixedCaseField' => 'Bill']);

0 commit comments

Comments
 (0)