mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 13:14:05 +00:00
Update SingleDatabaseTenancyTest.php
This commit is contained in:
parent
5c312e04ba
commit
76e5777bc2
1 changed files with 8 additions and 8 deletions
|
|
@ -204,16 +204,16 @@ test('the model returned by the tenant helper has unique and exists validation r
|
|||
Post::create(['text' => 'Foo', 'slug' => 'foo']);
|
||||
$data = ['text' => 'Foo 2', 'slug' => 'foo'];
|
||||
|
||||
$uniqueValidator = Validator::make($data, [
|
||||
$uniqueFails = Validator::make($data, [
|
||||
'slug' => 'unique:posts',
|
||||
]);
|
||||
$existsValidator= Validator::make($data, [
|
||||
])->fails();
|
||||
$existsPass = Validator::make($data, [
|
||||
'slug' => 'exists:posts',
|
||||
]);
|
||||
])->passes();
|
||||
|
||||
// Assert that 'unique' and 'exists' aren't scoped by default
|
||||
expect($uniqueValidator->fails())->toBeTrue() // Expect unique rule failed to pass because slug 'foo' already exists
|
||||
->and($existsValidator->passes())->toBeTrue(); // Expect exists rule pass because slug 'foo' exists
|
||||
expect($uniqueFails)->toBeTrue(); // Expect unique rule failed to pass because slug 'foo' already exists
|
||||
expect($existsPass)->toBeTrue(); // Expect exists rule pass because slug 'foo' exists
|
||||
|
||||
$uniqueFails = Validator::make($data, [
|
||||
'slug' => tenant()->unique('posts'),
|
||||
|
|
@ -223,8 +223,8 @@ test('the model returned by the tenant helper has unique and exists validation r
|
|||
])->fails();
|
||||
|
||||
// Assert that tenant()->unique() and tenant()->exists() are scoped
|
||||
expect($uniqueFails)->toBeTrue()
|
||||
->and($existsFails)->toBeFalse();
|
||||
expect($uniqueFails)->toBeTrue();
|
||||
expect($existsFails)->toBeFalse();
|
||||
});
|
||||
|
||||
// todo@tests
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue