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