Skip to content

Commit

Permalink
Remove short array notation
Browse files Browse the repository at this point in the history
  • Loading branch information
Florent DUBOST committed Dec 18, 2013
1 parent 79685a3 commit 21b413f
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 27 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
language: php

php:
- 5.3
- 5.4

before_script:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Redis PHP Mock [![Build Status](https://secure.travis-ci.org/M6Web/RedisMock.png)](http://travis-ci.org/M6Web/RedisMock)

PHP 5.4+ library providing a Redis PHP mock for your tests.
PHP 5.3 library providing a Redis PHP mock for your tests.

## Installation

Expand All @@ -9,7 +9,7 @@ Add this line in your `composer.json` :
```json
{
"require": {
"m6web/redis-mock": "dev-master"
"m6web/redis-mock": "~1.2"
}
}
```
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"psr-0": {"M6Web\\Component\\RedisMock": "src/"}
},
"require": {
"php": ">=5.4.0"
"php": ">=5.3.0"
},
"require-dev": {
"atoum/atoum": "master-dev"
Expand Down
6 changes: 3 additions & 3 deletions src/M6Web/Component/RedisMock/RedisMock.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ public function zrevrange($key, $start, $stop, $withscores = false)
return self::$pipeline ? $this : array_slice($set, $start, $length);
}

public function zrangebyscore($key, $min, $max, array $options = [])
public function zrangebyscore($key, $min, $max, array $options = array())
{
if (!empty($options['withscores'])) {
throw new UnsupportedException('Parameter `withscores` is not supported by RedisMock for `zrangebyscore` command.');
Expand Down Expand Up @@ -309,7 +309,7 @@ public function zrangebyscore($key, $min, $max, array $options = [])
return self::$pipeline ? $this : array_values(array_slice($results, $options['limit'][0], $options['limit'][1], true));
}

public function zrevrangebyscore($key, $max, $min, array $options = [])
public function zrevrangebyscore($key, $max, $min, array $options = array())
{
if (!empty($options['withscores'])) {
throw new UnsupportedException('Parameter `withscores` is not supported by RedisMock for `zrevrangebyscore` command.');
Expand Down Expand Up @@ -354,7 +354,7 @@ public function zrevrangebyscore($key, $max, $min, array $options = [])
}
};

$results = [];
$results = array();
foreach (self::$data[$key] as $k => $v) {
if ($min == '-inf' && $isInfMax($v)) {
$results[] = $k;
Expand Down
36 changes: 18 additions & 18 deletions tests/units/RedisMock.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,22 +82,22 @@ public function testKeys() {
->isEmpty()
->array($redisMock->keys('some*'))
->hasSize(2)
->containsValues(['something', 'someting_else'])
->containsValues(array('something', 'someting_else'))
->array($redisMock->keys('*o*'))
->hasSize(3)
->containsValues(['something', 'someting_else', 'others'])
->containsValues(array('something', 'someting_else', 'others'))
->array($redisMock->keys('*[ra]s*'))
->hasSize(1)
->containsValues(['others'])
->containsValues(array('others'))
->array($redisMock->keys('*[rl]s*'))
->hasSize(2)
->containsValues(['someting_else', 'others'])
->containsValues(array('someting_else', 'others'))
->array($redisMock->keys('somet?ing*'))
->hasSize(1)
->containsValues(['something'])
->containsValues(array('something'))
->array($redisMock->keys('somet*ing*'))
->hasSize(2)
->containsValues(['something', 'someting_else']);
->containsValues(array('something', 'someting_else'));
}

public function testSAddSMembersSIsMemberSRem()
Expand Down Expand Up @@ -129,7 +129,7 @@ public function testSAddSMembersSIsMemberSRem()
->isEqualTo(0)
->array($redisMock->smembers('test'))
->hasSize(1)
->containsValues(['test1'])
->containsValues(array('test1'))
->integer($redisMock->srem('test', 'test1'))
->isEqualTo(1)
->integer($redisMock->sismember('test', 'test1'))
Expand All @@ -140,7 +140,7 @@ public function testSAddSMembersSIsMemberSRem()
->isEqualTo(1)
->array($redisMock->smembers('test'))
->hasSize(2)
->containsValues(['test1', 'test2'])
->containsValues(array('test1', 'test2'))
->exception(function() use ($redisMock) {
$redisMock->srem('test', 'test1', 'test2');
})
Expand Down Expand Up @@ -387,24 +387,24 @@ public function testZRangeByScore()
'test3',
'test2',
))
->array($redisMock->zrangebyscore('test', '-inf', '15', ['limit' => [0, 2]]))
->array($redisMock->zrangebyscore('test', '-inf', '15', array('limit' => array(0, 2))))
->isEqualTo(array(
'test6',
'test1',
))
->array($redisMock->zrangebyscore('test', '-inf', '15', ['limit' => [1, 2]]))
->array($redisMock->zrangebyscore('test', '-inf', '15', array('limit' => array(1, 2))))
->isEqualTo(array(
'test1',
'test4',
))
->array($redisMock->zrangebyscore('test', '-inf', '15', ['limit' => [1, 3]]))
->array($redisMock->zrangebyscore('test', '-inf', '15', array('limit' => array(1, 3))))
->isEqualTo(array(
'test1',
'test4',
'test3',
))
->exception(function() use ($redisMock) {
$redisMock->zrangebyscore('test', '-inf', '15', ['limit' => [1, 3], 'withscores' => true]);
$redisMock->zrangebyscore('test', '-inf', '15', array('limit' => array(1, 3), 'withscores' => true));
})
->isInstanceOf('\M6Web\Component\RedisMock\UnsupportedException')
->integer($redisMock->del('test'))
Expand Down Expand Up @@ -468,24 +468,24 @@ public function testZRevRangeByScore()
'test2',
'test3',
))
->array($redisMock->zrevrangebyscore('test', '15', '-inf', ['limit' => [0, 2]]))
->array($redisMock->zrevrangebyscore('test', '15', '-inf', array('limit' => array(0, 2))))
->isEqualTo(array(
'test2',
'test3',
))
->array($redisMock->zrevrangebyscore('test', '15', '-inf', ['limit' => [1, 2]]))
->array($redisMock->zrevrangebyscore('test', '15', '-inf', array('limit' => array(1, 2))))
->isEqualTo(array(
'test3',
'test4',
))
->array($redisMock->zrevrangebyscore('test', '15', '-inf', ['limit' => [1, 3]]))
->array($redisMock->zrevrangebyscore('test', '15', '-inf', array('limit' => array(1, 3))))
->isEqualTo(array(
'test3',
'test4',
'test1',
))
->exception(function() use ($redisMock) {
$redisMock->zrevrangebyscore('test', '15', '-inf', ['limit' => [1, 3], 'withscores' => true]);
$redisMock->zrevrangebyscore('test', '15', '-inf', array('limit' => array(1, 3), 'withscores' => true));
})
->isInstanceOf('\M6Web\Component\RedisMock\UnsupportedException')
->integer($redisMock->del('test'))
Expand Down Expand Up @@ -519,12 +519,12 @@ public function testHSetHGetHexistsHGetAll()
->isEqualTo('something else')
->array($redisMock->hgetall('test'))
->hasSize(1)
->containsValues(['something else'])
->containsValues(array('something else'))
->integer($redisMock->hset('test', 'test2', 'something'))
->isEqualTo(1)
->array($redisMock->hgetall('test'))
->hasSize(2)
->containsValues(['something', 'something else'])
->containsValues(array('something', 'something else'))
->integer($redisMock->hexists('test', 'test1'))
->isEqualTo(1)
->integer($redisMock->hexists('test', 'test3'))
Expand Down
6 changes: 3 additions & 3 deletions tests/units/RedisMockFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function testMock()
->integer($mock->sAdd('test', 'test2'))
->isEqualTo(1)
->array($mock->sMembers('test'))
->isEqualTo(['test1', 'test2'])
->isEqualTo(array('test1', 'test2'))
->integer($mock->sRem('test', 'test1'))
->isEqualTo(1)
->integer($mock->sRem('test', 'test2'))
Expand Down Expand Up @@ -91,12 +91,12 @@ public function testMockComplex()
'test3',
'test2'
))
->array($mock->zRangeByScore('test', '-inf', '+inf', ['limit' => [1, 2]]))
->array($mock->zRangeByScore('test', '-inf', '+inf', array('limit' => array(1, 2))))
->isEqualTo(array(
'test3',
'test2'
))
->array($mock->zrevrangebyscore('test', '+inf', '-inf', ['limit' => [1, 2]]))
->array($mock->zrevrangebyscore('test', '+inf', '-inf', array('limit' => array(1, 2))))
->isEqualTo(array(
'test3',
'test1'
Expand Down

0 comments on commit 21b413f

Please sign in to comment.