Skip to content

Commit 9bc1e9e

Browse files
committed
Update phpunit and remove support for PHP 5.6 and 7.0
PHPUnit 6 introduced namespaces, so we cannot maintain a single testset that works both with PHPUnit 5 and PHPUnit 6+. Since both PHPUnit 5 and PHP 5 have now reached end-of-life, it's time to move on. The sru-client library might still work on older PHP versions, but official support is removed since it cannot be automatically tested anymore.
1 parent 95fce9f commit 9bc1e9e

File tree

5 files changed

+16
-21
lines changed

5 files changed

+16
-21
lines changed

.travis.yml

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

33
php:
4-
- 5.6
5-
- 7.0
64
- 7.1
5+
- 7.2
6+
- 7.3
77

88
before_script:
99
- echo 'date.timezone = "UTC"' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"homepage": "http://github.com/scriptotek/sru-client",
66
"keywords": ["sru"],
77
"require": {
8-
"php" : "^5.6 || ^7.0",
8+
"php" : "^7.1",
99
"danmichaelo/quitesimplexmlelement": "^1.0",
1010
"php-http/client-implementation": "^1.0",
1111
"php-http/httplug": "^1.1",
@@ -14,7 +14,7 @@
1414
"php-http/client-common": "^1.5"
1515
},
1616
"require-dev": {
17-
"phpunit/phpunit": "^4.8|^5.5",
17+
"phpunit/phpunit": "^7.0 || ^8.0",
1818
"sami/sami": "^3.3",
1919
"php-http/mock-client": "^1.0",
2020
"php-http/message": "^1.0",

tests/RecordsTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@ public function testIterating()
3232
$this->assertEquals($n, $i);
3333
}
3434

35-
/**
36-
* @expectedException Scriptotek\Sru\Exceptions\InvalidResponseException
37-
*/
3835
public function testRepeatSameResponse()
3936
{
4037
// Result set contains two records
@@ -51,9 +48,9 @@ public function testRepeatSameResponse()
5148
// Jumping to position 2 should call fetchMore() and throw
5249
// an InvalidResponseException on getting the same response
5350
// as we got for position 1
51+
$this->expectException(\Scriptotek\Sru\Exceptions\InvalidResponseException::class);
5452
$rec->next();
5553
}
56-
5754

5855
public function testMultipleRequests()
5956
{

tests/SearchRetrieveResponseTest.php

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,11 @@ public function testMultipleRecordsResult()
9393
$this->assertEquals('Record 1', $res->records[0]->data);
9494
}
9595

96-
/**
97-
* @expectedException Scriptotek\Sru\Exceptions\SruErrorException
98-
* @expectedExceptionMessage Unknown schema for retrieval (Invalid parameter: 'marcxml' for service: 'biblio')
99-
*/
10096
public function testErrorWithDetails()
10197
{
98+
$this->expectException(\Scriptotek\Sru\Exceptions\SruErrorException::class);
99+
$this->expectExceptionMessage("Unknown schema for retrieval (Invalid parameter: 'marcxml' for service: 'biblio'");
100+
102101
$res = new SearchRetrieveResponse('<srw:searchRetrieveResponse xmlns:srw="http://www.loc.gov/zing/srw/">
103102
<srw:version>1.1</srw:version>
104103
<srw:numberOfRecords>0</srw:numberOfRecords>
@@ -111,12 +110,11 @@ public function testErrorWithDetails()
111110
</srw:searchRetrieveResponse>');
112111
}
113112

114-
/**
115-
* @expectedException Scriptotek\Sru\Exceptions\SruErrorException
116-
* @expectedExceptionMessage General system error
117-
*/
118113
public function testErrorWithoutDetails()
119114
{
115+
$this->expectException(\Scriptotek\Sru\Exceptions\SruErrorException::class);
116+
$this->expectExceptionMessage("General system error");
117+
120118
$res = new SearchRetrieveResponse('<srw:searchRetrieveResponse xmlns:srw="http://www.loc.gov/zing/srw/">
121119
<srw:version>1.1</srw:version>
122120
<srw:numberOfRecords>0</srw:numberOfRecords>
@@ -128,12 +126,11 @@ public function testErrorWithoutDetails()
128126
</srw:searchRetrieveResponse>');
129127
}
130128

131-
/**
132-
* @expectedException Scriptotek\Sru\Exceptions\SruErrorException
133-
* @expectedExceptionMessage Too many boolean operators, the maximum is 10. Please try a less complex query. (10)
134-
*/
135129
public function testErrorWithCustomMessage()
136130
{
131+
$this->expectException(\Scriptotek\Sru\Exceptions\SruErrorException::class);
132+
$this->expectExceptionMessage("Too many boolean operators, the maximum is 10. Please try a less complex query. (10)");
133+
137134
$res = new SearchRetrieveResponse('<srw:searchRetrieveResponse xmlns:srw="http://www.loc.gov/zing/srw/">
138135
<srw:version>1.1</srw:version>
139136
<srw:numberOfRecords>0</srw:numberOfRecords>
@@ -156,6 +153,7 @@ public function testDiagnosticsWithoutError()
156153
<srw:diagnostics xmlns="http://www.loc.gov/zing/srw/diagnostic/">
157154
</srw:diagnostics>
158155
</srw:searchRetrieveResponse>');
156+
$this->assertCount(0, $res->records);
159157
}
160158

161159
public function testCanBeInitializedWithoutAnyData()

tests/TestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
use function GuzzleHttp\Psr7\stream_for;
55
use Http\Mock\Client as MockHttp;
66

7-
class TestCase extends \PHPUnit_Framework_TestCase
7+
class TestCase extends \PHPUnit\Framework\TestCase
88
{
99
protected $recordTpl = '<srw:record>
1010
<srw:recordSchema>marcxchange</srw:recordSchema>

0 commit comments

Comments
 (0)