Skip to content

Commit

Permalink
chore: align unit tests with PHP 7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
mvarendorff committed Nov 4, 2023
1 parent 19e2533 commit 1113efa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions templates/php/tests/QueryTest.php.twig
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ namespace Appwrite;
use PHPUnit\Framework\TestCase;
final class BasicFilterQueryTest {
public string $description;
public mixed $value;
public string $expectedValues;
public $description;
public $value;
public $expectedValues;
public function __construct(string $description, mixed $value, string $expectedValues) {
$this->description = $description;
Expand All @@ -20,7 +20,7 @@ final class QueryTest extends TestCase {
/**
* @var BasicFilterQueryTest[] $tests
*/
private array $tests;
private $tests;
function __construct(string $name)
{
Expand Down
6 changes: 3 additions & 3 deletions templates/php/tests/Services/ServiceTest.php.twig
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use Mockery;
use PHPUnit\Framework\TestCase;
final class {{service.name | caseUcfirst}}Test extends TestCase {
private Client $client;
private {{service.name | caseUcfirst}} ${{service.name | caseCamel}};
private $client;
private ${{service.name | caseCamel}};
protected function setUp(): void {
$this->client = Mockery::mock(Client::class);
Expand All @@ -34,7 +34,7 @@ final class {{service.name | caseUcfirst}}Test extends TestCase {
->andReturn($data);
$response = $this->{{service.name | caseCamel}}->{{method.name | caseCamel}}({%~ for parameter in method.parameters.all | filter((param) => param.required) ~%}
{{parameter.name | escapeKeyword | caseCamel}}: {% if parameter.type == 'object' %}array(){% elseif parameter.type == 'array' %}array(){% elseif parameter.type == 'file' %}InputFile::withData('', "image/png"){% elseif parameter.type == 'boolean' %}true{% elseif parameter.type == 'string' %}"{% if parameter.example is not empty %}{{parameter.example | escapeDollarSign}}{% endif %}"{% elseif parameter.type == 'integer' and parameter['x-example'] is empty %}1{% elseif parameter.type == 'number' and parameter['x-example'] is empty %}1.0{% else %}{{parameter.example}}{%~ endif ~%},{%~ endfor ~%}
{% if parameter.type == 'object' %}array(){% elseif parameter.type == 'array' %}array(){% elseif parameter.type == 'file' %}InputFile::withData('', "image/png"){% elseif parameter.type == 'boolean' %}true{% elseif parameter.type == 'string' %}"{% if parameter.example is not empty %}{{parameter.example | escapeDollarSign}}{% endif %}"{% elseif parameter.type == 'integer' and parameter['x-example'] is empty %}1{% elseif parameter.type == 'number' and parameter['x-example'] is empty %}1.0{% else %}{{parameter.example}}{%~ endif ~%}{% if not loop.last %},{% endif %}{%~ endfor ~%}
);
$this->assertSame($data, $response);
Expand Down

0 comments on commit 1113efa

Please sign in to comment.