mirror of
https://github.com/idanoo/php-resque.git
synced 2024-11-22 00:11:53 +00:00
basic redis tests passing
This commit is contained in:
parent
c862009505
commit
44413588f4
@ -1,6 +1,8 @@
|
||||
<?php
|
||||
declare(ticks=1);
|
||||
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
/**
|
||||
* Resque worker that handles checking queues for jobs, fetching them
|
||||
* off the queues, running them and handling the result.
|
||||
|
@ -11,6 +11,7 @@
|
||||
class Resque_Tests_EventTest extends Resque_Tests_TestCase
|
||||
{
|
||||
private $callbacksHit = array();
|
||||
private $worker;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
@ -146,13 +147,13 @@ class Resque_Tests_EventTest extends Resque_Tests_TestCase
|
||||
public function beforePerformEventDontPerformCallback($instance)
|
||||
{
|
||||
$this->callbacksHit[] = __FUNCTION__;
|
||||
throw new Resque_Job_DontPerform;
|
||||
throw new Resque_Job_DontPerform();
|
||||
}
|
||||
|
||||
public function beforeEnqueueEventDontCreateCallback($queue, $class, $args, $track = false)
|
||||
{
|
||||
$this->callbacksHit[] = __FUNCTION__;
|
||||
throw new Resque_Job_DontCreate;
|
||||
throw new Resque_Job_DontCreate();
|
||||
}
|
||||
|
||||
public function assertValidEventCallback($function, $job)
|
||||
|
@ -10,22 +10,15 @@
|
||||
|
||||
class Resque_Tests_RedisTest extends Resque_Tests_TestCase
|
||||
{
|
||||
/**
|
||||
* @expectedException Resque_RedisException
|
||||
*/
|
||||
// public function testRedisExceptionsAreSurfaced()
|
||||
// {
|
||||
// $mockCredis = $this->getMockBuilder('Credis_Client')
|
||||
// ->setMethods(['connect', '__call'])
|
||||
// ->getMock();
|
||||
// $mockCredis->expects($this->any())->method('__call')
|
||||
// ->will($this->throwException(new CredisException('failure')));
|
||||
//
|
||||
// Resque::setBackend(function($database) use ($mockCredis) {
|
||||
// return new Resque_Redis('localhost:6379', $database, $mockCredis);
|
||||
// });
|
||||
// Resque::redis()->ping();
|
||||
// }
|
||||
/**
|
||||
* @expectedException Test basic redis functionality.
|
||||
*/
|
||||
public function testRedisGetSet()
|
||||
{
|
||||
$this->redis->set("testKey", 24);
|
||||
$val = $this->redis->get("testKey");
|
||||
$this->assertEquals(24, $val);
|
||||
}
|
||||
|
||||
/**
|
||||
* These DNS strings are considered valid.
|
||||
|
@ -20,15 +20,11 @@ class Resque_Tests_TestCase extends PHPUnit\Framework\TestCase
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
// $config = file_get_contents(REDIS_CONF);
|
||||
// preg_match('#^\s*port\s+([0-9]+)#m', $config, $matches);
|
||||
// Setup redis connection on DB 9 for testing.
|
||||
$this->redis = new Redis();
|
||||
$this->redis->connect('localhost');
|
||||
$this->redis->select(9);
|
||||
|
||||
Resque::setBackend('localhost', 9);
|
||||
|
||||
// Flush redis
|
||||
Resque::setBackend('localhost');
|
||||
$this->redis->flushAll();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user