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

View File

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

View File

@ -11,21 +11,14 @@
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.

View File

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