Skip to content

Commit 949eef9

Browse files
committed
Re-add support for PHP 5.5
1 parent 0cfcafb commit 949eef9

File tree

4 files changed

+88
-4
lines changed

4 files changed

+88
-4
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ language: php
22

33
matrix:
44
include:
5+
- php: 5.5
56
- php: 5.6
67
- php: 7.0
78
- php: 7.1

CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1010
### Changed
1111

1212
- Change Code Style to PSR-2
13-
- Support for PHP 5.5 dropped, PHP >=5.6 is now required
1413
- Tests in Travis for PHP 7.2 and nightly added
1514

1615
## [0.9] - 2017-06-06

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
}
1414
],
1515
"require": {
16-
"php": "^5.6 || ^7.0"
16+
"php": "^5.5 || ^7.0"
1717
},
1818
"require-dev": {
19-
"phpunit/phpunit": "^5.4.3 || ^6.0"
19+
"phpunit/phpunit": "^4.8.35 || ^5.4.3 || ^6.0"
2020
},
2121
"autoload": {
2222
"psr-4": {
@@ -30,7 +30,7 @@
3030
},
3131
"config": {
3232
"//platform": {
33-
"php": "5.6"
33+
"php": "5.5"
3434
},
3535
"sort-packages": true
3636
}

tests/Fixtures/TestCase.php

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,76 @@
2121

2222
class TestCase extends \PHPUnit\Framework\TestCase
2323
{
24+
/**
25+
* Returns a test double for the specified class.
26+
*
27+
* Shim for PHPUnit 4
28+
*
29+
* @param string $originalClassName
30+
*
31+
* @throws Exception
32+
*
33+
* @return PHPUnit_Framework_MockObject_MockObject
34+
*/
35+
protected function createMock($originalClassName)
36+
{
37+
if (is_callable('parent::createMock')) {
38+
return parent::createMock($originalClassName);
39+
}
40+
41+
return $this->getMockBuilder($originalClassName)
42+
->disableOriginalConstructor()
43+
->disableOriginalClone()
44+
->disableArgumentCloning()
45+
->getMock();
46+
}
47+
48+
/**
49+
* Returns a mock object for the specified class.
50+
*
51+
* Shim for PHPUnit 6
52+
*
53+
* @param string $originalClassName name of the class to mock
54+
* @param array|null $methods When provided, only methods whose names are in the array
55+
* are replaced with a configurable test double. The behavior
56+
* of the other methods is not changed.
57+
* Providing null means that no methods will be replaced.
58+
* @param array $arguments parameters to pass to the original class' constructor
59+
* @param string $mockClassName class name for the generated test double class
60+
* @param bool $callOriginalConstructor can be used to disable the call to the original class' constructor
61+
* @param bool $callOriginalClone can be used to disable the call to the original class' clone constructor
62+
* @param bool $callAutoload can be used to disable __autoload() during the generation of the test double class
63+
* @param bool $cloneArguments
64+
* @param bool $callOriginalMethods
65+
* @param object $proxyTarget
66+
*
67+
* @throws PHPUnit_Framework_Exception
68+
*
69+
* @return PHPUnit_Framework_MockObject_MockObject
70+
*
71+
* @since Method available since Release 3.0.0
72+
*/
73+
public function getMock($originalClassName, $methods = [], array $arguments = [], $mockClassName = '', $callOriginalConstructor = true, $callOriginalClone = true, $callAutoload = true, $cloneArguments = false, $callOriginalMethods = false, $proxyTarget = null)
74+
{
75+
if (is_callable('parent::getMock')) {
76+
return parent::getMock(
77+
$originalClassName,
78+
$methods,
79+
$arguments,
80+
$mockClassName,
81+
$callOriginalConstructor,
82+
$callOriginalClone,
83+
$callAutoload,
84+
$cloneArguments,
85+
$callOriginalMethods,
86+
$proxyTarget
87+
);
88+
}
89+
90+
return $this->getMockBuilder($originalClassName)
91+
->getMock();
92+
}
93+
2494
/**
2595
* Shim for PHPUnit 6
2696
*
@@ -41,4 +111,18 @@ public function setExpectedException($exceptionName, $exceptionMessage = '', $ex
41111
$this->expectExceptionCode($exceptionCode);
42112
}
43113
}
114+
115+
/**
116+
* Shim for PHPUnit 4
117+
*
118+
* @param mixed $exceptionName
119+
*/
120+
public function expectException($exceptionName)
121+
{
122+
if (is_callable('parent::expectException')) {
123+
return parent::expectException($exceptionName);
124+
}
125+
126+
$this->setExpectedException($exceptionName);
127+
}
44128
}

0 commit comments

Comments
 (0)