Skip to content

Commit 9076ed3

Browse files
committed
Drop support for PHP 5.5
1 parent f5cb057 commit 9076ed3

18 files changed

+91
-162
lines changed

.travis.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@ language: php
22

33
matrix:
44
include:
5-
- php: 5.5
65
- php: 5.6
76
- php: 7.0
87
- php: 7.1
8+
- php: 7.2
99
env: COLLECT_COVERAGE=true
10+
- php: nightly
11+
allow_failures:
12+
- php: nightly
1013

1114
sudo: false
1215

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
All notable changes to this project will be documented in this file.
44
This project adheres to [Semantic Versioning](http://semver.org/).
55

6+
## [Unreleased]
7+
8+
### Changed
9+
10+
- Support for PHP 5.5 dropped, PHP >=5.6 is now required
11+
- Tests in Travis for PHP 7.2 and nightly added
12+
613
## [0.9] - 2017-06-06
714

815
### Added

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.5 || ^7.0"
16+
"php": "^5.6 || ^7.0"
1717
},
1818
"require-dev": {
19-
"phpunit/phpunit": "^4.8.35 || ^5.4.3 || ^6.0"
19+
"phpunit/phpunit": "^5.4.3 || ^6.0"
2020
},
2121
"autoload": {
2222
"psr-4": {
@@ -30,7 +30,7 @@
3030
},
3131
"config": {
3232
"//platform": {
33-
"php": "5.5"
33+
"php": "5.6"
3434
},
3535
"sort-packages": true
3636
}

tests/Fixtures/TestCase.php

Lines changed: 0 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -21,76 +21,6 @@
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-
* @return PHPUnit_Framework_MockObject_MockObject
31-
* @throws Exception
32-
*/
33-
protected function createMock($originalClassName)
34-
{
35-
if (is_callable('parent::createMock'))
36-
{
37-
return parent::createMock($originalClassName);
38-
}
39-
40-
return $this->getMockBuilder($originalClassName)
41-
->disableOriginalConstructor()
42-
->disableOriginalClone()
43-
->disableArgumentCloning()
44-
->getMock();
45-
}
46-
47-
/**
48-
* Returns a mock object for the specified class.
49-
*
50-
* Shim for PHPUnit 6
51-
*
52-
* @param string $originalClassName Name of the class to mock.
53-
* @param array|null $methods When provided, only methods whose names are in the array
54-
* are replaced with a configurable test double. The behavior
55-
* of the other methods is not changed.
56-
* Providing null means that no methods will be replaced.
57-
* @param array $arguments Parameters to pass to the original class' constructor.
58-
* @param string $mockClassName Class name for the generated test double class.
59-
* @param bool $callOriginalConstructor Can be used to disable the call to the original class' constructor.
60-
* @param bool $callOriginalClone Can be used to disable the call to the original class' clone constructor.
61-
* @param bool $callAutoload Can be used to disable __autoload() during the generation of the test double class.
62-
* @param bool $cloneArguments
63-
* @param bool $callOriginalMethods
64-
* @param object $proxyTarget
65-
*
66-
* @return PHPUnit_Framework_MockObject_MockObject
67-
*
68-
* @throws PHPUnit_Framework_Exception
69-
*
70-
* @since Method available since Release 3.0.0
71-
*/
72-
public function getMock($originalClassName, $methods = array(), array $arguments = array(), $mockClassName = '', $callOriginalConstructor = true, $callOriginalClone = true, $callAutoload = true, $cloneArguments = false, $callOriginalMethods = false, $proxyTarget = null)
73-
{
74-
if (is_callable('parent::getMock'))
75-
{
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-
9424
/**
9525
* Shim for PHPUnit 6
9626
*
@@ -113,19 +43,4 @@ public function setExpectedException($exceptionName, $exceptionMessage = '', $ex
11343
$this->expectExceptionCode($exceptionCode);
11444
}
11545
}
116-
117-
/**
118-
* Shim for PHPUnit 4
119-
*
120-
* @param mixed $exceptionName
121-
*/
122-
public function expectException($exceptionName)
123-
{
124-
if (is_callable('parent::expectException'))
125-
{
126-
return parent::expectException($exceptionName);
127-
}
128-
129-
$this->setExpectedException($exceptionName);
130-
}
13146
}

tests/Unit/AttributesTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function testCreateWithObject()
4949
$object->false = false;
5050
$object->null = null;
5151

52-
$attributes = new Attributes($this->manager, $this->getMock('Art4\JsonApiClient\AccessInterface'));
52+
$attributes = new Attributes($this->manager, $this->createMock('Art4\JsonApiClient\AccessInterface'));
5353
$attributes->parse($object);
5454

5555
$this->assertInstanceOf('Art4\JsonApiClient\Attributes', $attributes);
@@ -101,7 +101,7 @@ public function testCreateWithObject()
101101
*/
102102
public function testCreateWithDataProvider($input)
103103
{
104-
$attributes = new Attributes($this->manager, $this->getMock('Art4\JsonApiClient\AccessInterface'));
104+
$attributes = new Attributes($this->manager, $this->createMock('Art4\JsonApiClient\AccessInterface'));
105105

106106
// Input must be an object
107107
if ( gettype($input) === 'object' )
@@ -129,7 +129,7 @@ public function testCreateWithTypePropertyThrowsException()
129129
$object = new \stdClass();
130130
$object->type = 'posts';
131131

132-
$attributes = new Attributes($this->manager, $this->getMock('Art4\JsonApiClient\AccessInterface'));
132+
$attributes = new Attributes($this->manager, $this->createMock('Art4\JsonApiClient\AccessInterface'));
133133

134134
$this->setExpectedException(
135135
'Art4\JsonApiClient\Exception\ValidationException',
@@ -149,7 +149,7 @@ public function testCreateWithIdPropertyThrowsException()
149149
$object = new \stdClass();
150150
$object->id = '5';
151151

152-
$attributes = new Attributes($this->manager, $this->getMock('Art4\JsonApiClient\AccessInterface'));
152+
$attributes = new Attributes($this->manager, $this->createMock('Art4\JsonApiClient\AccessInterface'));
153153

154154
$this->setExpectedException(
155155
'Art4\JsonApiClient\Exception\ValidationException',
@@ -169,7 +169,7 @@ public function testCreateWithRelationshipsPropertyThrowsException()
169169
$object = new \stdClass();
170170
$object->relationships = new \stdClass();
171171

172-
$attributes = new Attributes($this->manager, $this->getMock('Art4\JsonApiClient\AccessInterface'));
172+
$attributes = new Attributes($this->manager, $this->createMock('Art4\JsonApiClient\AccessInterface'));
173173

174174
$this->setExpectedException(
175175
'Art4\JsonApiClient\Exception\ValidationException',
@@ -189,7 +189,7 @@ public function testCreateWithLinksPropertyThrowsException()
189189
$object = new \stdClass();
190190
$object->links = new \stdClass();
191191

192-
$attributes = new Attributes($this->manager, $this->getMock('Art4\JsonApiClient\AccessInterface'));
192+
$attributes = new Attributes($this->manager, $this->createMock('Art4\JsonApiClient\AccessInterface'));
193193

194194
$this->setExpectedException(
195195
'Art4\JsonApiClient\Exception\ValidationException',
@@ -207,7 +207,7 @@ public function testGetOnANonExistingKeyThrowsException()
207207
$object = new \stdClass();
208208
$object->pages = '1126';
209209

210-
$attributes = new Attributes($this->manager, $this->getMock('Art4\JsonApiClient\AccessInterface'));
210+
$attributes = new Attributes($this->manager, $this->createMock('Art4\JsonApiClient\AccessInterface'));
211211

212212
$attributes->parse($object);
213213

tests/Unit/DocumentTest.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,11 @@ public function testCreateWithDataproviderThrowsException($input)
117117
return;
118118
}
119119

120-
$this->setExpectedException('Art4\JsonApiClient\Exception\ValidationException');
120+
$this->setExpectedException(
121+
'Art4\JsonApiClient\Exception\ValidationException',
122+
sprintf('Document has to be an object, "%s" given.', gettype($input))
123+
);
124+
121125
$document->parse($input);
122126
}
123127

tests/Unit/ErrorCollectionTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function testCreate()
4444
new \stdClass(),
4545
);
4646

47-
$collection = new ErrorCollection($this->manager, $this->getMock('Art4\JsonApiClient\AccessInterface'));
47+
$collection = new ErrorCollection($this->manager, $this->createMock('Art4\JsonApiClient\AccessInterface'));
4848
$collection->parse($errors);
4949

5050
$this->assertInstanceOf('Art4\JsonApiClient\ErrorCollection', $collection);
@@ -100,7 +100,7 @@ public function testCreateWithoutArrayThrowsException($input)
100100
);
101101
}
102102

103-
$collection = new ErrorCollection($this->manager, $this->getMock('Art4\JsonApiClient\AccessInterface'));
103+
$collection = new ErrorCollection($this->manager, $this->createMock('Art4\JsonApiClient\AccessInterface'));
104104
$collection->parse($input);
105105
}
106106

@@ -113,7 +113,7 @@ public function testGetErrorWithEmptyCollectionThrowsException()
113113
new \stdClass(),
114114
);
115115

116-
$collection = new ErrorCollection($this->manager, $this->getMock('Art4\JsonApiClient\AccessInterface'));
116+
$collection = new ErrorCollection($this->manager, $this->createMock('Art4\JsonApiClient\AccessInterface'));
117117
$collection->parse($errors);
118118

119119
$this->assertInstanceOf('Art4\JsonApiClient\ErrorCollection', $collection);

tests/Unit/ErrorLinkTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function testAllPropertiesExists()
4848
$object->href = 'http://example.org/href';
4949
$object->about = 'http://example.org/about';
5050

51-
$link = new ErrorLink($this->manager, $this->getMock('Art4\JsonApiClient\AccessInterface'));
51+
$link = new ErrorLink($this->manager, $this->createMock('Art4\JsonApiClient\AccessInterface'));
5252
$link->parse($object);
5353

5454
$this->assertInstanceOf('Art4\JsonApiClient\ErrorLink', $link);
@@ -84,7 +84,7 @@ public function testAboutMustBeSet()
8484
$object = new \stdClass();
8585
$object->foobar = new \stdClass();
8686

87-
$link = new ErrorLink($this->manager, $this->getMock('Art4\JsonApiClient\AccessInterface'));
87+
$link = new ErrorLink($this->manager, $this->createMock('Art4\JsonApiClient\AccessInterface'));
8888

8989
$this->setExpectedException(
9090
'Art4\JsonApiClient\Exception\ValidationException',
@@ -106,7 +106,7 @@ public function testAboutCanBeAnObject()
106106
$object = new \stdClass();
107107
$object->about = new \stdClass();
108108

109-
$link = new ErrorLink($this->manager, $this->getMock('Art4\JsonApiClient\AccessInterface'));
109+
$link = new ErrorLink($this->manager, $this->createMock('Art4\JsonApiClient\AccessInterface'));
110110
$link->parse($object);
111111

112112
$this->assertInstanceOf('Art4\JsonApiClient\ErrorLink', $link);
@@ -123,7 +123,7 @@ public function testAboutCanBeAnObject()
123123
*/
124124
public function testCreateWithDataprovider($input)
125125
{
126-
$link = new ErrorLink($this->manager, $this->getMock('Art4\JsonApiClient\AccessInterface'));
126+
$link = new ErrorLink($this->manager, $this->createMock('Art4\JsonApiClient\AccessInterface'));
127127

128128
// Input must be an object
129129
if ( gettype($input) === 'object' )
@@ -148,7 +148,7 @@ public function testCreateWithDataprovider($input)
148148
*/
149149
public function testCreateWithoutObjectOrStringAttributeThrowsException($input)
150150
{
151-
$link = new ErrorLink($this->manager, $this->getMock('Art4\JsonApiClient\AccessInterface'));
151+
$link = new ErrorLink($this->manager, $this->createMock('Art4\JsonApiClient\AccessInterface'));
152152

153153
// Input must be an object
154154
if ( gettype($input) === 'string' or gettype($input) === 'object' )
@@ -177,7 +177,7 @@ public function testCreateWithoutObjectOrStringAttributeThrowsException($input)
177177
*/
178178
public function testAboutWithDataproviderThrowsException($input)
179179
{
180-
$link = new ErrorLink($this->manager, $this->getMock('Art4\JsonApiClient\AccessInterface'));
180+
$link = new ErrorLink($this->manager, $this->createMock('Art4\JsonApiClient\AccessInterface'));
181181

182182
// Input must be string or object
183183
if ( gettype($input) === 'string' or gettype($input) === 'object' )
@@ -206,7 +206,7 @@ public function testGetOnANonExistingKeyThrowsException()
206206
$object = new \stdClass();
207207
$object->about = 'http://example.org/about';
208208

209-
$link = new ErrorLink($this->manager, $this->getMock('Art4\JsonApiClient\AccessInterface'));
209+
$link = new ErrorLink($this->manager, $this->createMock('Art4\JsonApiClient\AccessInterface'));
210210
$link->parse($object);
211211

212212
$this->assertFalse($link->has('something'));

tests/Unit/ErrorSourceTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function testOnlyPointerParameterPropertiesExists()
4848
$object->parameter = 'parameter';
4949
$object->ignore = 'must be ignored';
5050

51-
$source = new ErrorSource($this->manager, $this->getMock('Art4\JsonApiClient\AccessInterface'));
51+
$source = new ErrorSource($this->manager, $this->createMock('Art4\JsonApiClient\AccessInterface'));
5252
$source->parse($object);
5353

5454
$this->assertInstanceOf('Art4\JsonApiClient\ErrorSource', $source);
@@ -90,7 +90,7 @@ public function testOnlyPointerParameterPropertiesExists()
9090
*/
9191
public function testCreateWithoutObjectThrowsException($input)
9292
{
93-
$source = new ErrorSource($this->manager, $this->getMock('Art4\JsonApiClient\AccessInterface'));
93+
$source = new ErrorSource($this->manager, $this->createMock('Art4\JsonApiClient\AccessInterface'));
9494

9595
// Input must be an object
9696
if ( gettype($input) === 'object' )
@@ -115,7 +115,7 @@ public function testCreateWithoutObjectThrowsException($input)
115115
*/
116116
public function testPointerMustBeAString($input)
117117
{
118-
$source = new ErrorSource($this->manager, $this->getMock('Art4\JsonApiClient\AccessInterface'));
118+
$source = new ErrorSource($this->manager, $this->createMock('Art4\JsonApiClient\AccessInterface'));
119119

120120
// Input must be a string
121121
if ( gettype($input) === 'string' )
@@ -143,7 +143,7 @@ public function testPointerMustBeAString($input)
143143
*/
144144
public function testParameterMustBeAString($input)
145145
{
146-
$source = new ErrorSource($this->manager, $this->getMock('Art4\JsonApiClient\AccessInterface'));
146+
$source = new ErrorSource($this->manager, $this->createMock('Art4\JsonApiClient\AccessInterface'));
147147

148148
// Input must be a string
149149
if ( gettype($input) === 'string' )

0 commit comments

Comments
 (0)