-
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.
cakephp 5 version. prepare for release
- Loading branch information
Showing
24 changed files
with
487 additions
and
71 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
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,71 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace CakeDC\SearchFilter\Test\TestCase\Controller; | ||
|
||
use Cake\TestSuite\IntegrationTestTrait; | ||
use Cake\TestSuite\TestCase; | ||
|
||
class ArticlesControllerTest extends TestCase | ||
{ | ||
use IntegrationTestTrait; | ||
|
||
protected array $fixtures = [ | ||
'plugin.CakeDC/SearchFilter.Articles', | ||
'plugin.CakeDC/SearchFilter.Authors', | ||
]; | ||
|
||
public function setUp(): void | ||
{ | ||
parent::setUp(); | ||
} | ||
|
||
public function testIndex(): void | ||
{ | ||
$this->get('/articles'); | ||
$this->assertResponseOk(); | ||
$this->assertResponseContains('Articles'); | ||
} | ||
|
||
public function testString(): void | ||
{ | ||
$this->get('/articles?f[0]=title&c[0]=like&v[0][value][]=First'); | ||
$this->assertResponseOk(); | ||
$this->assertResponseContains('First Article'); | ||
$this->assertResponseNotContains('Second Article'); | ||
} | ||
|
||
public function testAuthorLike(): void | ||
{ | ||
$this->get('/articles?f[0]=author_id&c[0]=like&v[0][value][]=larry'); | ||
$this->assertResponseOk(); | ||
$this->assertResponseContains('Second Article'); | ||
$this->assertResponseNotContains('First Article'); | ||
} | ||
|
||
public function testAuthorEqual(): void | ||
{ | ||
$this->get('/articles?f[0]=author_id&c[0]=%3D&v[0][id][]=1'); | ||
// debug($this->_getBodyAsString()); | ||
$this->assertResponseOk(); | ||
$this->assertResponseContains('First Article'); | ||
$this->assertResponseNotContains('Second Article'); | ||
} | ||
|
||
public function testCreatedDate(): void | ||
{ | ||
$this->get('/articles?f[0]=created&c[0]=between&v[0][from]=2023-01-01T00:00&v[0][to]=2023-12-31T00:00'); | ||
$this->assertResponseOk(); | ||
$this->assertResponseContains('First Article'); | ||
$this->assertResponseNotContains('Old Article'); | ||
} | ||
|
||
public function testCombinedFilters(): void | ||
{ | ||
$this->get('/articles?f[0]=title&c[0]=like&v[0][value][]=First&f[1]=created&c[1]=greaterOrEqual&v[1][value][]=2023-01-01T00:00'); | ||
$this->assertResponseOk(); | ||
$this->assertResponseContains('First Article'); | ||
$this->assertResponseNotContains('Second Article'); | ||
$this->assertResponseNotContains('Old Article'); | ||
} | ||
} |
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,22 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
/** | ||
* Copyright 2019 Cake Development Corporation, Las Vegas, Nevada (702) 425-5085 www.cakedc.com use and restrictions are governed by Section 8.5 of The Professional Services Agreement. | ||
* Redistribution is prohibited. All Rights Reserved. | ||
*/ | ||
|
||
namespace CakeDC\SearchFilter\Test\App\Controller; | ||
|
||
use Cake\Controller\Controller; | ||
|
||
/** | ||
* This is a placeholder class. | ||
* Create the same file in app/Controller/AppController.php | ||
* | ||
* Add your application-wide methods in the class below, your controllers | ||
* will inherit them. | ||
*/ | ||
class AppController extends Controller | ||
{ | ||
} |
Oops, something went wrong.