mirror of
https://github.com/idanoo/php-resque
synced 2025-07-01 05:32:20 +00:00
- Reformatted files to PSR2 standard
- Removed credis for native phpredis - Tidied up some docs - Setting up new travis.ci build
This commit is contained in:
parent
065d5a4c63
commit
ae84530132
30 changed files with 3724 additions and 2682 deletions
|
@ -1,49 +1,51 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Resque_Stat tests.
|
||||
*
|
||||
* @package Resque/Tests
|
||||
* @author Chris Boulton <chris@bigcommerce.com>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php
|
||||
* @package Resque/Tests
|
||||
* @author Chris Boulton <chris@bigcommerce.com>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php
|
||||
*/
|
||||
|
||||
class Resque_Tests_StatTest extends Resque_Tests_TestCase
|
||||
{
|
||||
public function testStatCanBeIncremented()
|
||||
{
|
||||
Resque_Stat::incr('test_incr');
|
||||
Resque_Stat::incr('test_incr');
|
||||
$this->assertEquals(2, $this->redis->get('resque:stat:test_incr'));
|
||||
}
|
||||
public function testStatCanBeIncremented()
|
||||
{
|
||||
Resque_Stat::incr('test_incr');
|
||||
Resque_Stat::incr('test_incr');
|
||||
$this->assertEquals(2, $this->redis->get('resque:stat:test_incr'));
|
||||
}
|
||||
|
||||
public function testStatCanBeIncrementedByX()
|
||||
{
|
||||
Resque_Stat::incr('test_incrX', 10);
|
||||
Resque_Stat::incr('test_incrX', 11);
|
||||
$this->assertEquals(21, $this->redis->get('resque:stat:test_incrX'));
|
||||
}
|
||||
public function testStatCanBeIncrementedByX()
|
||||
{
|
||||
Resque_Stat::incr('test_incrX', 10);
|
||||
Resque_Stat::incr('test_incrX', 11);
|
||||
$this->assertEquals(21, $this->redis->get('resque:stat:test_incrX'));
|
||||
}
|
||||
|
||||
public function testStatCanBeDecremented()
|
||||
{
|
||||
Resque_Stat::incr('test_decr', 22);
|
||||
Resque_Stat::decr('test_decr');
|
||||
$this->assertEquals(21, $this->redis->get('resque:stat:test_decr'));
|
||||
}
|
||||
public function testStatCanBeDecremented()
|
||||
{
|
||||
Resque_Stat::incr('test_decr', 22);
|
||||
Resque_Stat::decr('test_decr');
|
||||
$this->assertEquals(21, $this->redis->get('resque:stat:test_decr'));
|
||||
}
|
||||
|
||||
public function testStatCanBeDecrementedByX()
|
||||
{
|
||||
Resque_Stat::incr('test_decrX', 22);
|
||||
Resque_Stat::decr('test_decrX', 11);
|
||||
$this->assertEquals(11, $this->redis->get('resque:stat:test_decrX'));
|
||||
}
|
||||
public function testStatCanBeDecrementedByX()
|
||||
{
|
||||
Resque_Stat::incr('test_decrX', 22);
|
||||
Resque_Stat::decr('test_decrX', 11);
|
||||
$this->assertEquals(11, $this->redis->get('resque:stat:test_decrX'));
|
||||
}
|
||||
|
||||
public function testGetStatByName()
|
||||
{
|
||||
Resque_Stat::incr('test_get', 100);
|
||||
$this->assertEquals(100, Resque_Stat::get('test_get'));
|
||||
}
|
||||
public function testGetStatByName()
|
||||
{
|
||||
Resque_Stat::incr('test_get', 100);
|
||||
$this->assertEquals(100, Resque_Stat::get('test_get'));
|
||||
}
|
||||
|
||||
public function testGetUnknownStatReturns0()
|
||||
{
|
||||
$this->assertEquals(0, Resque_Stat::get('test_get_unknown'));
|
||||
}
|
||||
public function testGetUnknownStatReturns0()
|
||||
{
|
||||
$this->assertEquals(0, Resque_Stat::get('test_get_unknown'));
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue