Skip to content

Commit

Permalink
fix(pest): complete.
Browse files Browse the repository at this point in the history
  • Loading branch information
陆云峰 committed Sep 1, 2022
1 parent f855bc6 commit 0dc9f2d
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/Feature/OrWhereMorphRelationInTest.php
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);
});
25 changes: 25 additions & 0 deletions tests/Feature/OrWhereRelationInTest.php
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);
});
13 changes: 13 additions & 0 deletions tests/Feature/WhereMorphRelationInTest.php
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);
});
17 changes: 17 additions & 0 deletions tests/Feature/WhereRelationInTest.php
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);
});

0 comments on commit 0dc9f2d

Please sign in to comment.