-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
569cf49
commit 811d8e7
Showing
8 changed files
with
106 additions
and
7 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
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,44 @@ | ||
<?php | ||
|
||
namespace Tests\Unit\ConditionsBuilder; | ||
|
||
use Illuminate\Pagination\LengthAwarePaginator; | ||
use Illuminate\Support\Facades\DB; | ||
use MatrixLab\LaravelAdvancedSearch\ModelScope; | ||
use Tests\DBTestCase; | ||
use Tests\Utils\Models\Company; | ||
use Tests\Utils\Models\Post; | ||
use Tests\Utils\Models\User; | ||
|
||
class SimpleLikeQueryTest extends DBTestCase | ||
{ | ||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
Company::factory()->make([ | ||
'name' => 'this name is testing for search, first name', | ||
])->save(); | ||
Company::factory()->make([ | ||
'name' => 'this name is testing for search, double first name', | ||
])->save(); | ||
Company::factory()->make([ | ||
'name' => 'this name is testing for search, second name', | ||
])->save(); | ||
|
||
User::factory()->make([ | ||
|
||
]); | ||
} | ||
|
||
public function test_without_scope() | ||
{ | ||
self::assertEquals(2, Company::advanced(['wheres' => [ | ||
'name.like' => '%first%', | ||
]])->count()); | ||
} | ||
|
||
public function test_with_cope() | ||
{ | ||
|
||
} | ||
} |
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,35 @@ | ||
<?php | ||
|
||
namespace Tests\Unit\ConditionsBuilder; | ||
|
||
use Tests\DBTestCase; | ||
use Tests\Utils\Models\Company; | ||
use Tests\Utils\Models\User; | ||
|
||
class WhereQueryTest extends DBTestCase | ||
{ | ||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
User::factory()->count(10)->create(); | ||
User::factory()->make([ | ||
'name' => 'zhuzhichao', | ||
'email' => '[email protected]', | ||
])->save(); | ||
} | ||
|
||
public function test_model_without_search_keyword_method() | ||
{ | ||
self::assertEquals(Company::count(), Company::advanced([ | ||
'keyword' => 'Chou' | ||
])->count()); | ||
} | ||
|
||
public function test_model_with_search_keyword_method() | ||
{ | ||
self::assertEquals(1, User::advanced([ | ||
'keyword' => 'zhichao' | ||
])->count()); | ||
} | ||
} |
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