diff --git a/lib/Resque/Worker.php b/lib/Resque/Worker.php index af6c50c..cb2c92d 100644 --- a/lib/Resque/Worker.php +++ b/lib/Resque/Worker.php @@ -1,6 +1,8 @@ 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) diff --git a/test/Resque/Tests/RedisTest.php b/test/Resque/Tests/RedisTest.php index 6bc4047..2caffc2 100644 --- a/test/Resque/Tests/RedisTest.php +++ b/test/Resque/Tests/RedisTest.php @@ -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. diff --git a/test/Resque/Tests/TestCase.php b/test/Resque/Tests/TestCase.php index db0d346..478a27c 100644 --- a/test/Resque/Tests/TestCase.php +++ b/test/Resque/Tests/TestCase.php @@ -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(); } }