Added Event lib unit tests
This commit is contained in:
parent
21961f2191
commit
3d44665484
|
@ -11,6 +11,7 @@
|
||||||
<testsuites>
|
<testsuites>
|
||||||
<testsuite name="Application Test Suite">
|
<testsuite name="Application Test Suite">
|
||||||
<directory>./tests/e2e/</directory>
|
<directory>./tests/e2e/</directory>
|
||||||
|
<directory>./tests/unit/</directory>
|
||||||
</testsuite>
|
</testsuite>
|
||||||
</testsuites>
|
</testsuites>
|
||||||
</phpunit>
|
</phpunit>
|
51
tests/unit/Event/EventTest.php
Normal file
51
tests/unit/Event/EventTest.php
Normal file
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue