Skip to content

Commit

Permalink
Drop support of versions older than 7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
vdechenaux committed Nov 24, 2017
1 parent d95ed32 commit b34290c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 63 deletions.
5 changes: 0 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
language: php

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

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
62 changes: 6 additions & 56 deletions tests/units/RedisMockFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,17 +125,15 @@ public function testGetAdapterClass()
/**
* Build mock by using 'orphanizeConstruct' parameter
*
* @php < 7.1
* @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 @@ -150,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 All @@ -171,55 +170,6 @@ public function testOrphanizeConstruct() {
->notExists();
}

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

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

$this->assert
->object($mock)
->isInstanceOf('M6Web\Component\RedisMock\RedisMock_M6Web_Component_RedisMock_tests_units_RedisWithNativeConstructor_Adapter')
->class(get_class($mock))
->extends('M6Web\Component\RedisMock\tests\units\RedisWithNativeConstructor');

$this->assert
->string($class = $factory->getAdapterClass('M6Web\Component\RedisMock\tests\units\RedisWithNativeConstructor'))
->isEqualTo('M6Web\Component\RedisMock\RedisMock_M6Web_Component_RedisMock_tests_units_RedisWithNativeConstructor_Adapter_NativeConstructor')
->class($class)
->extends('M6Web\Component\RedisMock\tests\units\RedisWithNativeConstructor')
->exception(function() use ($class) {
$mock = new $class();
})
->isInstanceOf(\ArgumentCountError::class);

$this->assert
->when(function() use ($class) {
$mock = new $class(null);
})
->error()
->notExists()
->string($class2 = $factory->getAdapterClass('M6Web\Component\RedisMock\tests\units\RedisWithNativeConstructor', false, true))
->isEqualTo('M6Web\Component\RedisMock\RedisMock_M6Web_Component_RedisMock_tests_units_RedisWithNativeConstructor_Adapter')
->class($class2)
->extends('M6Web\Component\RedisMock\tests\units\RedisWithNativeConstructor')
->when(function() use ($class2) {
$mock = new $class2();
})
->error()
->notExists();
}

/**
* Test the mock with a base class that implement unsupported Redis commands
*
Expand Down

0 comments on commit b34290c

Please sign in to comment.