Skip to content

Commit de9daa4

Browse files
Add test to verify connection name detection in Unique rule. (#54993)
1 parent 9a5b570 commit de9daa4

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tests/Validation/ValidationUniqueRuleTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ public function testItCorrectlyFormatsAStringVersionOfTheRule()
8080
$rule = new Unique('table');
8181
$rule->where('foo', '"bar"');
8282
$this->assertSame('unique:table,NULL,NULL,id,foo,"""bar"""', (string) $rule);
83+
84+
$rule = new Unique(EloquentModelWithConnection::class, 'column');
85+
$rule->where('foo', 'bar');
86+
$this->assertSame('unique:mysql.table,column,NULL,id,foo,"bar"', (string) $rule);
8387
}
8488

8589
public function testItIgnoresSoftDeletes()
@@ -170,3 +174,8 @@ public function __construct($bar, $baz)
170174
$this->baz = $baz;
171175
}
172176
}
177+
178+
class EloquentModelWithConnection extends EloquentModelStub
179+
{
180+
protected $connection = 'mysql';
181+
}

0 commit comments

Comments
 (0)