mirror of
https://github.com/idanoo/php-resque
synced 2025-07-01 21:52:21 +00:00
2.0.0 Add namespacing + PHP8.0 support (#1)
2.0.0 (2021-02-19) Moved to PSR-4 Namespaced codebase Added more comments throughout Co-Authored-By: idanoo <daniel@m2.nz> Co-Committed-By: idanoo <daniel@m2.nz>
This commit is contained in:
parent
ebec2f7bf7
commit
80d64e79ff
56 changed files with 2215 additions and 1423 deletions
53
tests/Resque/Tests/StatTest.php
Normal file
53
tests/Resque/Tests/StatTest.php
Normal file
|
@ -0,0 +1,53 @@
|
|||
<?php
|
||||
|
||||
namespace Resque\Test;
|
||||
|
||||
/**
|
||||
* Resque\Stat tests.
|
||||
*
|
||||
* @package Resque/Tests
|
||||
* @author Daniel Mason <daniel@m2.nz>
|
||||
* @license http://www.opensource.org/licenses/mit-license.php
|
||||
*/
|
||||
|
||||
class StatTest extends 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 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 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 testGetUnknownStatReturns0()
|
||||
{
|
||||
$this->assertEquals(0, \Resque\Stat::get('test_get_unknown'));
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue