Skip to content

Commit e6b4782

Browse files
authored
Require PHP7 and PHPUnit 6 (#7)
* require PHP7 * cs * Removed bootstrap file * Added missing response
1 parent 5e268dc commit e6b4782

File tree

5 files changed

+31
-10
lines changed

5 files changed

+31
-10
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
s:52:"{
2+
"results" : [],
3+
"status" : "ZERO_RESULTS"
4+
}
5+
";

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717
}
1818
],
1919
"require": {
20-
"php": "^5.5 || ^7.0",
21-
"phpunit/phpunit": "^4.8 || ^5.4",
20+
"php": "^7.0",
21+
"phpunit/phpunit": "^6.1",
2222
"psr/http-message-implementation": "^1.0",
2323
"willdurand/geocoder": "^4.0",
2424
"php-http/mock-client": "^1.0",
25-
"guzzlehttp/psr7": "^1.4"
25+
"nyholm/psr7": "^0.2.2"
2626
},
2727
"require-dev": {
2828
"php-http/curl-client": "^1.7"

src/BaseTestCase.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,31 @@
1010

1111
namespace Geocoder\IntegrationTest;
1212

13-
use GuzzleHttp\Psr7\Response;
1413
use Http\Client\Curl\Client as HttplugClient;
1514
use Http\Client\HttpClient;
15+
use Http\Discovery\ClassDiscovery;
1616
use Http\Mock\Client as MockedHttpClient;
17+
use Nyholm\Psr7\Response;
18+
use PHPUnit\Framework\TestCase;
1719
use Psr\Http\Message\RequestInterface;
1820
use Psr\Http\Message\ResponseInterface;
1921

2022
/**
2123
* @author Tobias Nyholm <[email protected]>
2224
*/
23-
abstract class BaseTestCase extends \PHPUnit_Framework_TestCase
25+
abstract class BaseTestCase extends TestCase
2426
{
2527
/**
2628
* @return string|null the directory where cached responses are stored
2729
*/
2830
abstract protected function getCacheDir();
2931

32+
public static function setUpBeforeClass()
33+
{
34+
parent::setUpBeforeClass();
35+
ClassDiscovery::prependStrategy('\Nyholm\Psr7\Httplug\DiscoveryStrategy');
36+
}
37+
3038
/**
3139
* Get a real HTTP client. If a cache dir is set to a path it will use cached responses.
3240
*

src/CachedResponseClient.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010

1111
namespace Geocoder\IntegrationTest;
1212

13-
use GuzzleHttp\Psr7;
14-
use GuzzleHttp\Psr7\Response;
1513
use Http\Client\HttpClient;
14+
use Nyholm\Psr7\Factory\StreamFactory;
15+
use Nyholm\Psr7\Response;
1616
use Psr\Http\Message\RequestInterface;
1717

1818
/**
@@ -62,7 +62,7 @@ public function sendRequest(RequestInterface $request)
6262

6363
$file = sprintf('%s/%s_%s', $this->cacheDir, $host, sha1($url));
6464
if (is_file($file) && is_readable($file)) {
65-
return new Response(200, [], Psr7\stream_for(unserialize(file_get_contents($file))));
65+
return new Response(200, [], (new StreamFactory())->createStream(unserialize(file_get_contents($file))));
6666
}
6767

6868
$response = $this->delegate->sendRequest($request);

src/ProviderIntegrationTest.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,17 @@
1919
use Geocoder\Provider\Provider;
2020
use Geocoder\Query\GeocodeQuery;
2121
use Geocoder\Query\ReverseQuery;
22-
use GuzzleHttp\Psr7\Response;
2322
use Http\Client\HttpClient;
23+
use Http\Discovery\ClassDiscovery;
2424
use Http\Discovery\HttpClientDiscovery;
25+
use Nyholm\Psr7\Response;
26+
use PHPUnit\Framework\TestCase;
2527
use Psr\Http\Message\ResponseInterface;
2628

2729
/**
2830
* @author Tobias Nyholm <[email protected]>
2931
*/
30-
abstract class ProviderIntegrationTest extends \PHPUnit_Framework_TestCase
32+
abstract class ProviderIntegrationTest extends TestCase
3133
{
3234
/**
3335
* @var array with functionName => reason
@@ -49,6 +51,12 @@ abstract protected function getCacheDir();
4951
*/
5052
abstract protected function getApiKey();
5153

54+
public static function setUpBeforeClass()
55+
{
56+
parent::setUpBeforeClass();
57+
ClassDiscovery::prependStrategy('\Nyholm\Psr7\Httplug\DiscoveryStrategy');
58+
}
59+
5260
/**
5361
* @param ResponseInterface $response
5462
*

0 commit comments

Comments
 (0)