1
0
Fork 0
mirror of synced 2024-08-20 20:51:40 +12:00
appwrite/tests/unit/Utopia/Request/Filters/V16Test.php
Steven Nguyen 65e2e79457
Fix create execution request filter from previous SDK version
When an older SDK executes a function without passing any data, the
data param is unset/null so we need to make sure to handle that case.
2023-09-04 16:10:49 -07:00

57 lines
1.1 KiB
PHP

<?php
namespace Tests\Unit\Utopia\Request\Filters;
use Appwrite\Utopia\Request\Filter;
use Appwrite\Utopia\Request\Filters\V16;
use Appwrite\Utopia\Response\Model;
use PHPUnit\Framework\TestCase;
class V16Test extends TestCase
{
/**
* @var Filter
*/
protected $filter;
public function setUp(): void
{
$this->filter = new V16();
}
public function tearDown(): void
{
}
public function createExecutionProvider(): array
{
return [
'data' => [
[
'data' => 'Lorem ipsum'
],
[
'body' => 'Lorem ipsum'
],
],
'no data' => [
[],
[
'body' => ''
],
],
];
}
/**
* @dataProvider createExecutionProvider
*/
public function testCreateExecution(array $content, array $expected): void
{
$model = 'functions.createExecution';
$result = $this->filter->parse($content, $model);
$this->assertEquals($expected, $result);
}
}