mirror of
https://github.com/idanoo/php-resque.git
synced 2024-11-21 16:01:53 +00:00
Enable redis server in travis for testing
This commit is contained in:
parent
bc39882dd7
commit
c862009505
@ -1,10 +1,14 @@
|
||||
language: php
|
||||
|
||||
php:
|
||||
- 7.0
|
||||
- 7.1
|
||||
- 7.2
|
||||
- hhvm
|
||||
|
||||
services:
|
||||
- redis-server
|
||||
|
||||
before_script:
|
||||
- echo "extension = redis.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
|
||||
- composer install
|
||||
|
@ -14,11 +14,11 @@
|
||||
"require": {
|
||||
"php": ">=7.0.0",
|
||||
"ext-pcntl": "*",
|
||||
"ext-redis": "Native PHP extension for Redis connectivity*",
|
||||
"psr/log": "~1.0"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-proctitle": "Allows php-resque to rename the title of UNIX processes to show the status of a worker.",
|
||||
"ext-redis": "Native PHP extension for Redis connectivity. Credis will automatically utilize when available."
|
||||
"ext-proctitle": "Allows php-resque to rename the title of UNIX processes to show the status of a worker."
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^6"
|
||||
|
1526
composer.lock
generated
Normal file
1526
composer.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -124,7 +124,7 @@ class Resque_Redis
|
||||
|
||||
$timeout = isset($options['timeout']) ? intval($options['timeout']) : null;
|
||||
|
||||
$this->redisConnection = new \Redis();
|
||||
$this->redisConnection = new Redis();
|
||||
|
||||
if (!$this->redisConnection->connect($host, $port, $timeout)) {
|
||||
throw new RedisException("Connection Failed to Redis!");
|
||||
|
@ -323,11 +323,11 @@ class Resque_Tests_JobTest extends Resque_Tests_TestCase
|
||||
public function testDequeueItemWithArg()
|
||||
{
|
||||
$queue = 'jobs';
|
||||
$arg = array('foo' => 1, 'bar' => 2);
|
||||
$arg = ['foo' => 1, 'bar' => 2];
|
||||
Resque::enqueue($queue, 'Test_Job_Dequeue9');
|
||||
Resque::enqueue($queue, 'Test_Job_Dequeue9', $arg);
|
||||
$this->assertEquals(Resque::size($queue), 2);
|
||||
$test = array('Test_Job_Dequeue9' => $arg);
|
||||
$test = ['Test_Job_Dequeue9' => $arg];
|
||||
$this->assertEquals(Resque::dequeue($queue, $test), 1);
|
||||
#$this->assertEquals(Resque::size($queue), 1);
|
||||
}
|
||||
@ -336,16 +336,16 @@ class Resque_Tests_JobTest extends Resque_Tests_TestCase
|
||||
{
|
||||
// GIVEN
|
||||
$queue = 'jobs';
|
||||
$args = array('foo' => 1, 'bar' => 10);
|
||||
$removeArgs = array('foo' => 1, 'bar' => 2);
|
||||
$args = ['foo' => 1, 'bar' => 10];
|
||||
$removeArgs = ['foo' => 1, 'bar' => 2];
|
||||
Resque::enqueue($queue, 'Test_Job_Dequeue9', $args);
|
||||
Resque::enqueue($queue, 'Test_Job_Dequeue9', $removeArgs);
|
||||
Resque::enqueue($queue, 'Test_Job_Dequeue9', $removeArgs);
|
||||
$this->assertEquals(Resque::size($queue), 3);
|
||||
$this->assertEquals(Resque::size($queue), 3, "Failed to add 3 items.");
|
||||
|
||||
// WHEN
|
||||
$test = array('Test_Job_Dequeue9' => $removeArgs);
|
||||
$removedItems = Resque::dequeue($queue, $test);
|
||||
$test = ['Test_Job_Dequeue9' => $removeArgs];
|
||||
$removedItems = Resque::dequeue($queue, $test, "Dequeue one failed!");
|
||||
|
||||
// THEN
|
||||
$this->assertEquals($removedItems, 2);
|
||||
|
@ -22,7 +22,7 @@ class Resque_Tests_TestCase extends PHPUnit\Framework\TestCase
|
||||
{
|
||||
// $config = file_get_contents(REDIS_CONF);
|
||||
// preg_match('#^\s*port\s+([0-9]+)#m', $config, $matches);
|
||||
$this->redis = new \Redis();
|
||||
$this->redis = new Redis();
|
||||
$this->redis->connect('localhost');
|
||||
$this->redis->select(9);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user