Skip to content

Commit

Permalink
Merge pull request #61 from vdechenaux/php7.2
Browse files Browse the repository at this point in the history
Drop old PHP versions support + add support of PHP 7.2
  • Loading branch information
omansour authored Nov 27, 2017
2 parents cbd4773 + b34290c commit ab0ae6b
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 15 deletions.
7 changes: 2 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
language: php

php:
- 5.3
- 5.4
- 5.5
- 5.6
- 7
- 7.1
- 7.2

before_script:
- wget http://getcomposer.org/composer.phar
Expand Down
2 changes: 1 addition & 1 deletion 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.svg?branch=master)](http://travis-ci.org/M6Web/RedisMock) [![Total Downloads](https://poser.pugx.org/m6web/redis-mock/downloads.svg)](https://packagist.org/packages/m6web/redis-mock)

PHP 5.3 library providing a Redis PHP mock for your tests.
PHP 7.1 library providing a Redis PHP mock for your tests.

**Work for now only with predis**

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.3.3"
"php": ">=7.1.0"
},
"require-dev": {
"atoum/atoum": "master-dev",
Expand Down
2 changes: 1 addition & 1 deletion src/M6Web/Component/RedisMock/RedisMock.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ public function del($key)
$deletedKeyCount = 0;
foreach ( $keys as $k ) {
if ( isset(self::$dataValues[$this->storage][$k]) ) {
$deletedKeyCount += count(self::$dataValues[$this->storage][$k]);
$deletedKeyCount += is_array(self::$dataValues[$this->storage][$k]) ? count(self::$dataValues[$this->storage][$k]) : 1;
unset(self::$dataValues[$this->storage][$k]);
unset(self::$dataTypes[$this->storage][$k]);
if (array_key_exists($k, self::$dataTtl[$this->storage])) {
Expand Down
14 changes: 7 additions & 7 deletions tests/units/RedisMockFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,17 +124,16 @@ public function testGetAdapterClass()

/**
* Build mock by using 'orphanizeConstruct' parameter
*
*
* @return void
*/
public function testOrphanizeConstruct() {
$factory = new Factory();
$this->assert
->when(function() use ($factory) {
->exception(function() use ($factory) {
$factory->getAdapter('M6Web\Component\RedisMock\tests\units\RedisWithNativeConstructor', false, false);
})
->error()
->exists();
->isInstanceOf(\ArgumentCountError::class);;

$mock = $factory->getAdapter('M6Web\Component\RedisMock\tests\units\RedisWithNativeConstructor');

Expand All @@ -149,11 +148,12 @@ public function testOrphanizeConstruct() {
->isEqualTo('M6Web\Component\RedisMock\RedisMock_M6Web_Component_RedisMock_tests_units_RedisWithNativeConstructor_Adapter_NativeConstructor')
->class($class)
->extends('M6Web\Component\RedisMock\tests\units\RedisWithNativeConstructor')
->when(function() use ($class) {
->exception(function() use ($class) {
$mock = new $class();
})
->error()
->exists()
->isInstanceOf(\ArgumentCountError::class);

$this->assert
->when(function() use ($class) {
$mock = new $class(null);
})
Expand Down

0 comments on commit ab0ae6b

Please sign in to comment.