1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-05 17:14:03 +00:00

Update SingleDatabaseTenancyTest.php

This commit is contained in:
Abrar Ahmad 2022-09-23 12:59:56 +05:00
parent 5c312e04ba
commit 76e5777bc2

View file

@ -204,16 +204,16 @@ test('the model returned by the tenant helper has unique and exists validation r
Post::create(['text' => 'Foo', 'slug' => 'foo']); Post::create(['text' => 'Foo', 'slug' => 'foo']);
$data = ['text' => 'Foo 2', 'slug' => 'foo']; $data = ['text' => 'Foo 2', 'slug' => 'foo'];
$uniqueValidator = Validator::make($data, [ $uniqueFails = Validator::make($data, [
'slug' => 'unique:posts', 'slug' => 'unique:posts',
]); ])->fails();
$existsValidator= Validator::make($data, [ $existsPass = Validator::make($data, [
'slug' => 'exists:posts', 'slug' => 'exists:posts',
]); ])->passes();
// Assert that 'unique' and 'exists' aren't scoped by default // 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 expect($uniqueFails)->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($existsPass)->toBeTrue(); // Expect exists rule pass because slug 'foo' exists
$uniqueFails = Validator::make($data, [ $uniqueFails = Validator::make($data, [
'slug' => tenant()->unique('posts'), 'slug' => tenant()->unique('posts'),
@ -223,8 +223,8 @@ test('the model returned by the tenant helper has unique and exists validation r
])->fails(); ])->fails();
// Assert that tenant()->unique() and tenant()->exists() are scoped // Assert that tenant()->unique() and tenant()->exists() are scoped
expect($uniqueFails)->toBeTrue() expect($uniqueFails)->toBeTrue();
->and($existsFails)->toBeFalse(); expect($existsFails)->toBeFalse();
}); });
// todo@tests // todo@tests