appwrite/tests/unit/GraphQL/BuilderTest.php

30 lines
699 B
PHP
Raw Normal View History

2021-03-16 20:05:48 +00:00
<?php
2022-10-11 01:20:19 +00:00
namespace Tests\Unit\GraphQL;
2021-03-16 20:05:48 +00:00
2022-10-12 00:57:37 +00:00
use Appwrite\GraphQL\Types\Mapper;
2021-03-16 20:05:48 +00:00
use Appwrite\Utopia\Response;
use PHPUnit\Framework\TestCase;
use Swoole\Http\Response as SwooleResponse;
class BuilderTest extends TestCase
{
2022-07-13 09:34:56 +00:00
protected ?Response $response = null;
2021-03-16 20:05:48 +00:00
public function setUp(): void
{
2024-10-08 07:54:40 +00:00
$this->response = new Response(new SwooleResponse());
Mapper::init($this->response->getModels());
2021-03-16 20:05:48 +00:00
}
2022-07-13 09:34:56 +00:00
/**
* @throws \Exception
*/
2022-07-11 21:52:00 +00:00
public function testCreateTypeMapping()
2021-03-16 20:05:48 +00:00
{
$model = $this->response->getModel(Response::MODEL_TABLE);
2022-10-14 05:01:39 +00:00
$type = Mapper::model(\ucfirst($model->getType()));
$this->assertEquals('Table', $type->name);
2021-03-16 20:05:48 +00:00
}
2022-07-11 21:52:00 +00:00
}