mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
Added Event lib unit tests
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
<testsuites>
|
||||
<testsuite name="Application Test Suite">
|
||||
<directory>./tests/e2e/</directory>
|
||||
<directory>./tests/unit/</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
</phpunit>
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace Appwrite\Tests;
|
||||
|
||||
use Exception;
|
||||
use Utopia\Request;
|
||||
use Event\Event;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class LocaleTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var Event
|
||||
*/
|
||||
protected $object = null;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $queue = '';
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$request = new Request();
|
||||
$redisHost = $request->getServer('_APP_REDIS_HOST', '');
|
||||
$redisPort = $request->getServer('_APP_REDIS_PORT', '');
|
||||
\Resque::setBackend($redisHost.':'.$redisPort);
|
||||
|
||||
$this->queue = 'v1-tests' . uniqid();
|
||||
$this->object = new Event($this->queue, 'TestsV1');
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
{
|
||||
}
|
||||
|
||||
public function testParams()
|
||||
{
|
||||
$this->object
|
||||
->setParam('key1', 'value1')
|
||||
->setParam('key2', 'value2')
|
||||
;
|
||||
|
||||
$this->object->trigger();
|
||||
|
||||
$this->assertEquals('value1', $this->object->getParam('key1'));
|
||||
$this->assertEquals('value2', $this->object->getParam('key2'));
|
||||
$this->assertEquals(null, $this->object->getParam('key3'));
|
||||
$this->assertEquals(\Resque::size($this->queue), 1);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user