feat: added unit test for setFilter
This commit is contained in:
parent
c508657a50
commit
a37a28fdc9
2 changed files with 36 additions and 2 deletions
|
@ -17,7 +17,7 @@ class V06 extends Filter {
|
|||
// Convert 0.7 Data format to 0.6 format
|
||||
public function parse(array $content, string $model): array {
|
||||
|
||||
$parsedResponse = array();
|
||||
$parsedResponse = [];
|
||||
|
||||
switch($model) {
|
||||
|
||||
|
|
34
tests/unit/Utopia/ResponseTest.php
Normal file
34
tests/unit/Utopia/ResponseTest.php
Normal file
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
namespace Appwrite\Tests;
|
||||
|
||||
use Appwrite\Utopia\Response;
|
||||
use Appwrite\Utopia\Response\Filter\V06;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Swoole\Http\Response as SwooleResponse;
|
||||
|
||||
class ResponseTest extends TestCase
|
||||
{
|
||||
|
||||
/**
|
||||
* @var Response
|
||||
*/
|
||||
protected $object = null;
|
||||
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->object = new Response(new SwooleResponse());
|
||||
}
|
||||
|
||||
public function testSetFilter()
|
||||
{
|
||||
$this->assertEquals($this->object->isFilter(), false);
|
||||
$this->assertEquals($this->object->getFilter(), null);
|
||||
|
||||
$filter = new V06();
|
||||
$this->object->setFilter($filter);
|
||||
|
||||
$this->assertEquals($this->object->isFilter(), true);
|
||||
$this->assertEquals($this->object->getFilter(), $filter);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue