-
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
8f16572
commit f855bc6
Showing
17 changed files
with
169 additions
and
38 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
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
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,11 @@ | ||
<?php | ||
|
||
use BiiiiiigMonster\Hasin\Tests\Models\Comment; | ||
use BiiiiiigMonster\Hasin\Tests\Models\Post; | ||
|
||
test('doesntHaveMorphIn same as doesntHaveMorph', function () { | ||
$doesntHaveMorph = Comment::doesntHaveMorph('commentable', [Post::class])->orderBy('id')->pluck('id'); | ||
$doesntHaveMorphIn = Comment::doesntHaveMorphIn('commentable', [Post::class])->orderBy('id')->pluck('id'); | ||
|
||
expect($doesntHaveMorph)->toEqual($doesntHaveMorphIn); | ||
}); |
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,18 @@ | ||
<?php | ||
|
||
use BiiiiiigMonster\Hasin\Tests\Models\Comment; | ||
use BiiiiiigMonster\Hasin\Tests\Models\Post; | ||
|
||
test('hasMorphIn same as hasMorph', function () { | ||
$hasMorph = Comment::hasMorph('commentable', [Post::class])->orderBy('id')->pluck('id'); | ||
$hasMorphIn = Comment::hasMorphIn('commentable', [Post::class])->orderBy('id')->pluck('id'); | ||
|
||
expect($hasMorph)->toEqual($hasMorphIn); | ||
}); | ||
|
||
test('hasMorphIn(gte 2) same as hasMorph(gte 2)', function () { | ||
$hasMorph = Comment::hasMorph('commentable', [Post::class], '>=', 2)->orderBy('id')->pluck('id'); | ||
$hasMorphIn = Comment::hasMorphIn('commentable', [Post::class], '>=', 2)->orderBy('id')->pluck('id'); | ||
|
||
expect($hasMorph)->toEqual($hasMorphIn); | ||
}); |
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,11 @@ | ||
<?php | ||
|
||
use BiiiiiigMonster\Hasin\Tests\Models\Comment; | ||
use BiiiiiigMonster\Hasin\Tests\Models\Post; | ||
|
||
test('orDoesntHaveMorphIn same as orDoesntHaveMorph', function () { | ||
$orDoesntHaveMorph = Comment::where('status', '>', 2)->orDoesntHaveMorph('commentable', [Post::class])->orderBy('id')->pluck('id'); | ||
$orDoesntHaveMorphIn = Comment::where('status', '>', 2)->orDoesntHaveMorphIn('commentable', [Post::class])->orderBy('id')->pluck('id'); | ||
|
||
expect($orDoesntHaveMorph)->toEqual($orDoesntHaveMorphIn); | ||
}); |
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,18 @@ | ||
<?php | ||
|
||
use BiiiiiigMonster\Hasin\Tests\Models\Comment; | ||
use BiiiiiigMonster\Hasin\Tests\Models\Post; | ||
|
||
test('orHasMorphIn same as orHasMorph', function () { | ||
$orHasMorph = Comment::where('status', '>', 2)->orHasMorph('commentable', [Post::class])->orderBy('id')->pluck('id'); | ||
$orHasMorphIn = Comment::where('status', '>', 2)->orHasMorphIn('commentable', [Post::class])->orderBy('id')->pluck('id'); | ||
|
||
expect($orHasMorph)->toEqual($orHasMorphIn); | ||
}); | ||
|
||
test('orHasMorphIn(gte 2) same as orHasMorph(gte 2)', function () { | ||
$orHasMorph = Comment::where('status', '>', 2)->orHasMorph('commentable', [Post::class], '>=', 2)->orderBy('id')->pluck('id'); | ||
$orHasMorphIn = Comment::where('status', '>', 2)->orHasMorphIn('commentable', [Post::class], '>=', 2)->orderBy('id')->pluck('id'); | ||
|
||
expect($orHasMorph)->toEqual($orHasMorphIn); | ||
}); |
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
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('orWhereDoesntHaveMorphIn same as orWhereDoesntHaveMorph', function () { | ||
$orWhereDoesntHaveMorph = Comment::where('status', '>', 2)->orWhereDoesntHaveMorph('commentable', [Post::class], function ($query) { | ||
$query->where('title', 'like', '%code%'); | ||
})->orderBy('id')->pluck('id'); | ||
$orWhereDoesntHaveMorphIn = Comment::where('status', '>', 2)->orWhereDoesntHaveMorphIn('commentable', [Post::class], function ($query) { | ||
$query->where('title', 'like', '%code%'); | ||
})->orderBy('id')->pluck('id'); | ||
|
||
expect($orWhereDoesntHaveMorph)->toEqual($orWhereDoesntHaveMorphIn); | ||
}); |
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
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('orWhereHasMorphIn same as orWhereHasMorph', function () { | ||
$orWhereHasMorph = Comment::where('status', '>', 2)->orWhereHasMorph('commentable', [Post::class], function ($query) { | ||
$query->where('title', 'like', '%code%'); | ||
})->orderBy('id')->pluck('id'); | ||
$orWhereHasMorphIn = Comment::where('status', '>', 2)->orWhereHasMorphIn('commentable', [Post::class], function ($query) { | ||
$query->where('title', 'like', '%code%'); | ||
})->orderBy('id')->pluck('id'); | ||
|
||
expect($orWhereHasMorph)->toEqual($orWhereHasMorphIn); | ||
}); |
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
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('whereDoesntHaveMorphIn same as whereDoesntHaveMorph', function () { | ||
$whereDoesntHaveMorph = Comment::whereDoesntHaveMorph('commentable', [Post::class], function ($query) { | ||
$query->where('title', 'like', '%code%'); | ||
})->orderBy('id')->pluck('id'); | ||
$whereDoesntHaveMorphIn = Comment::whereDoesntHaveMorphIn('commentable', [Post::class], function ($query) { | ||
$query->where('title', 'like', '%code%'); | ||
})->orderBy('id')->pluck('id'); | ||
|
||
expect($whereDoesntHaveMorph)->toEqual($whereDoesntHaveMorphIn); | ||
}); |
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
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('whereHasMorphIn same as whereHasMorph', function () { | ||
$whereHasMorph = Comment::whereHasMorph('commentable', [Post::class], function ($query) { | ||
$query->where('title', 'like', '%code%'); | ||
})->orderBy('id')->pluck('id'); | ||
$whereHasMorphIn = Comment::whereHasMorphIn('commentable', [Post::class], function ($query) { | ||
$query->where('title', 'like', '%code%'); | ||
})->orderBy('id')->pluck('id'); | ||
|
||
expect($whereHasMorph)->toEqual($whereHasMorphIn); | ||
}); |
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
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
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