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