-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
陆云峰
committed
Sep 1, 2022
1 parent
f855bc6
commit 0dc9f2d
Showing
4 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
use BiiiiiigMonster\Hasin\Tests\Models\Comment; | ||
use BiiiiiigMonster\Hasin\Tests\Models\Post; | ||
|
||
test('orWhereMorphRelationIn same as orWhereMorphRelationIn', function () { | ||
$orWhereMorphRelation = Comment::where('status', '>=', 2) | ||
->orWhereMorphRelation('commentable', [Post::class], 'title', 'like', '%code%') | ||
->orderBy('id')->pluck('id'); | ||
$orWhereMorphRelationIn = Comment::where('status', '>=', 2) | ||
->orWhereMorphRelationIn('commentable', [Post::class], 'title', 'like', '%code%') | ||
->orderBy('id')->pluck('id'); | ||
|
||
expect($orWhereMorphRelation)->toEqual($orWhereMorphRelationIn); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
use BiiiiiigMonster\Hasin\Tests\Models\User; | ||
|
||
test('orWhereRelationIn same as orWhereRelation', function () { | ||
$orWhereRelation = User::where('age', '>', 18) | ||
->orWhereRelation('posts', 'title', 'like', '%code%') | ||
->orderBy('id')->pluck('id'); | ||
$orWhereRelationIn = User::where('age', '>', 18) | ||
->orWhereRelationIn('posts', 'title', 'like', '%code%') | ||
->orderBy('id')->pluck('id'); | ||
|
||
expect($orWhereRelation)->toEqual($orWhereRelationIn); | ||
}); | ||
|
||
test('nested whereRelationIn same as nested whereRelation', function () { | ||
$orWhereRelation = User::where('age', '>', 18) | ||
->orWhereRelation('posts.comments', 'status', '>=', '2') | ||
->orderBy('id')->pluck('id'); | ||
$orWhereRelationIn = User::where('age', '>', 18) | ||
->orWhereRelationIn('posts.comments', 'status', '>=', '2') | ||
->orderBy('id')->pluck('id'); | ||
|
||
expect($orWhereRelation)->toEqual($orWhereRelationIn); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
use BiiiiiigMonster\Hasin\Tests\Models\Comment; | ||
use BiiiiiigMonster\Hasin\Tests\Models\Post; | ||
|
||
test('whereMorphRelationIn same as whereMorphRelation', function () { | ||
$whereMorphRelation = Comment::whereMorphRelation('commentable', [Post::class], 'title', 'like', '%code%') | ||
->orderBy('id')->pluck('id'); | ||
$whereMorphRelationIn = Comment::whereMorphRelationIn('commentable', [Post::class], 'title', 'like', '%code%') | ||
->orderBy('id')->pluck('id'); | ||
|
||
expect($whereMorphRelation)->toEqual($whereMorphRelationIn); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
use BiiiiiigMonster\Hasin\Tests\Models\User; | ||
|
||
test('whereRelationIn same as whereRelation', function () { | ||
$whereRelation = User::whereRelation('posts', 'title', 'like', '%code%')->orderBy('id')->pluck('id'); | ||
$whereRelationIn = User::whereRelationIn('posts', 'title', 'like', '%code%')->orderBy('id')->pluck('id'); | ||
|
||
expect($whereRelation)->toEqual($whereRelationIn); | ||
}); | ||
|
||
test('nested whereRelationIn same as nested whereRelation', function () { | ||
$whereRelation = User::whereRelation('posts.comments', 'status', '>=', '2')->orderBy('id')->pluck('id'); | ||
$whereRelationIn = User::whereRelationIn('posts.comments', 'status', '>=', '2')->orderBy('id')->pluck('id'); | ||
|
||
expect($whereRelation)->toEqual($whereRelationIn); | ||
}); |