mirror of
https://github.com/appwrite/appwrite
synced 2026-05-24 09:28:40 +00:00
test: Adjusting unit testing to new structure
This commit is contained in:
parent
cf30941514
commit
1b80ec289b
4 changed files with 14 additions and 7 deletions
|
|
@ -11,7 +11,7 @@ use Utopia\Queue;
|
|||
use Utopia\Queue\Client;
|
||||
use Utopia\System\System;
|
||||
|
||||
//require_once __DIR__ . '/../../../app/init.php';
|
||||
require_once __DIR__ . '/../../../app/init2.php';
|
||||
|
||||
class EventTest extends TestCase
|
||||
{
|
||||
|
|
@ -66,9 +66,13 @@ class EventTest extends TestCase
|
|||
$this->assertEquals('eventValue1', $this->object->getParam('eventKey1'));
|
||||
$this->assertEquals('eventValue2', $this->object->getParam('eventKey2'));
|
||||
$this->assertEquals(null, $this->object->getParam('eventKey3'));
|
||||
global $register;
|
||||
$pools = $register->get('pools');
|
||||
$client = new Client($this->object->getQueue(), $pools->get('queue')->pop()->getResource());
|
||||
|
||||
global $global;
|
||||
$pools = $global->get('pools');
|
||||
$dsn = $pools['pools-queue-main']['dsn'];
|
||||
$queue = new Queue\Connection\Redis($dsn->getHost(), $dsn->getPort());
|
||||
|
||||
$client = new Client($this->object->getQueue(), $queue);
|
||||
$this->assertEquals($client->getQueueSize(), 1);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ use Appwrite\GraphQL\Types\Mapper;
|
|||
use Appwrite\Utopia\Response;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Swoole\Http\Response as SwooleResponse;
|
||||
use Utopia\Http\Adapter\Swoole\Response as UtopiaSwooleResponse;
|
||||
|
||||
class BuilderTest extends TestCase
|
||||
{
|
||||
|
|
@ -13,7 +14,7 @@ class BuilderTest extends TestCase
|
|||
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->response = new Response(new SwooleResponse());
|
||||
$this->response = new Response(new UtopiaSwooleResponse(new SwooleResponse()));
|
||||
Mapper::init($this->response->getModels());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ namespace Tests\Unit\Utopia;
|
|||
use Appwrite\Utopia\Request;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Swoole\Http\Request as SwooleRequest;
|
||||
use Utopia\Http\Adapter\Swoole\Request as UtopiaSwooleRequest;
|
||||
use Tests\Unit\Utopia\Request\Filters\First;
|
||||
use Tests\Unit\Utopia\Request\Filters\Second;
|
||||
use Utopia\Http\Route;
|
||||
|
|
@ -15,7 +16,7 @@ class RequestTest extends TestCase
|
|||
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->request = new Request(new SwooleRequest());
|
||||
$this->request = new Request(new UtopiaSwooleRequest(new SwooleRequest()));
|
||||
}
|
||||
|
||||
public function testFilters(): void
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ use Swoole\Http\Response as SwooleResponse;
|
|||
use Tests\Unit\Utopia\Response\Filters\First;
|
||||
use Tests\Unit\Utopia\Response\Filters\Second;
|
||||
use Utopia\Database\Document;
|
||||
use Utopia\Http\Adapter\Swoole\Response as UtopiaSwooleResponse;
|
||||
|
||||
class ResponseTest extends TestCase
|
||||
{
|
||||
|
|
@ -16,7 +17,7 @@ class ResponseTest extends TestCase
|
|||
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->response = new Response(new SwooleResponse());
|
||||
$this->response = new Response(new UtopiaSwooleResponse(new SwooleResponse()));
|
||||
$this->response->setModel(new Single());
|
||||
$this->response->setModel(new Lists());
|
||||
$this->response->setModel(new Nested());
|
||||
|
|
|
|||
Loading…
Reference in a new issue