diff --git a/.travis.yml b/.travis.yml index 7579ef1..c56cdaa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,6 +13,7 @@ matrix: - php: 7.2 - php: 7.3 - php: 7.4 + - php: 8.0 cache: directories: diff --git a/composer.json b/composer.json index 8f4bc29..47f3129 100644 --- a/composer.json +++ b/composer.json @@ -21,11 +21,11 @@ } }, "require": { - "php": "^7.1.3", + "php": "^7.1.3 || ^8.0", "florianv/exchanger": "^2.0" }, "require-dev": { - "phpunit/phpunit": "^7.5", + "phpunit/phpunit": "^7 || ^8 || ^9", "php-http/mock-client": "^1.0", "php-http/message": "^1.7", "nyholm/psr7": "^1.0" diff --git a/tests/BuilderTest.php b/tests/BuilderTest.php index 766b677..5c7cf79 100644 --- a/tests/BuilderTest.php +++ b/tests/BuilderTest.php @@ -28,7 +28,7 @@ class BuilderTest extends TestCase */ private $builder; - protected function setUp() + protected function setUp(): void { parent::setUp(); @@ -56,12 +56,12 @@ public function testBuildMultipleServicesAdded() $this->assertInstanceOf(Swap::class, $this->builder->build()); } - /** - * @expectedException \LogicException - * @expectedExceptionMessage Client must be an instance of Http\Client\HttpClient or Psr\Http\Client\ClientInterface - */ public function testUseInvalidClient() { + $this->expectException(\LogicException::class); + $expectedExceptionMessage = 'Client must be an instance of Http\Client\HttpClient or Psr\Http\Client\ClientInterface'; + $this->expectExceptionMessage($expectedExceptionMessage); + $builder = new Builder(); $builder->useHttpClient(new \stdClass()); } diff --git a/tests/Service/FactoryTest.php b/tests/Service/FactoryTest.php index 4756df9..3112392 100644 --- a/tests/Service/FactoryTest.php +++ b/tests/Service/FactoryTest.php @@ -28,6 +28,7 @@ use Exchanger\Service\Xignite; use Exchanger\Service\RussianCentralBank; use Exchanger\Service\XchangeApi; +use Http\Discovery\NotFoundException; use Http\Mock\Client; use PHPUnit\Framework\TestCase; use Swap\Service\Factory; @@ -62,7 +63,7 @@ public function servicesProvider() ['xignite', Xignite::class, ['token' => 'token']], ['russian_central_bank', RussianCentralBank::class], ['cryptonator', Cryptonator::class], - ['xchangeapi', XchangeApi::class, ['api-key' => 'api-key']] + ['xchangeapi', XchangeApi::class, ['api-key' => 'api-key']], ]; } @@ -87,30 +88,30 @@ public function testCustomServices() $this->assertSame($service, $factory->create('baz')); } - /** - * @expectedException \LogicException - * @expectedExceptionMessage Client must be an instance of Http\Client\HttpClient or Psr\Http\Client\ClientInterface - */ public function testConstructInvalidClient() { + $this->expectException(\LogicException::class); + $expectedExceptionMessage = 'Client must be an instance of Http\Client\HttpClient or Psr\Http\Client\ClientInterface'; + $this->expectExceptionMessage($expectedExceptionMessage); + $factory = new Factory(new \stdClass()); } - /** - * @expectedException \Http\Discovery\NotFoundException - * @expectedExceptionMessage No HTTPlug clients found. Make sure to install a package providing "php-http/client-implementation" - */ public function testWithNullAsClient() { + $this->expectException(NotFoundException::class); + $expectedExceptionMessage = 'No HTTPlug clients found. Make sure to install a package providing "php-http/client-implementation"'; + $this->expectExceptionMessage($expectedExceptionMessage); + $factory = new Factory(); } - /** - * @expectedException \LogicException - * @expectedExceptionMessage Client must be an instance of Http\Client\HttpClient or Psr\Http\Client\ClientInterface - */ public function testSetInvalidClient() { + $this->expectException(\LogicException::class); + $expectedExceptionMessage = 'Client must be an instance of Http\Client\HttpClient or Psr\Http\Client\ClientInterface'; + $this->expectExceptionMessage($expectedExceptionMessage); + $factory = new Factory(new Client()); $factory->setHttpClient(new \stdClass()); }