basic redis tests passing

This commit is contained in:
Daniel Mason 2018-05-25 20:11:17 +12:00
parent c862009505
commit 44413588f4
4 changed files with 16 additions and 24 deletions

View File

@ -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.

View File

@ -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)

View File

@ -11,21 +11,14 @@
class Resque_Tests_RedisTest extends Resque_Tests_TestCase
{
/**
* @expectedException Resque_RedisException
* @expectedException Test basic redis functionality.
*/
// 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();
// }
public function testRedisGetSet()
{
$this->redis->set("testKey", 24);
$val = $this->redis->get("testKey");
$this->assertEquals(24, $val);
}
/**
* These DNS strings are considered valid.

View File

@ -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();
}
}