From a0db9922ff06654982db8f6ac0c77d174d9f5e45 Mon Sep 17 00:00:00 2001 From: Toni Rudolf Date: Thu, 4 Feb 2021 15:57:38 +0100 Subject: [PATCH] PHP8 and Symfony 5 support --- .travis.yml | 1 + composer.json | 6 +++--- tests/BaseTest.php | 10 +++++----- tests/EventsTest.php | 7 ++++--- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index 48400f3..6af9f94 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,7 @@ php: - 7.2 - 7.3 - 7.4 + - 8.0 matrix: include: diff --git a/composer.json b/composer.json index 37f2e7a..4eb9dd6 100644 --- a/composer.json +++ b/composer.json @@ -8,12 +8,12 @@ "email": "goetas@gmail.com" }], "require": { - "php": "^7.1", + "php": "^7.1|^8.0", "goetas-webservices/xsd-reader": "^0.3", - "symfony/event-dispatcher": "^2.4||^3.0||^4.0" + "symfony/event-dispatcher": "^2.4|^3.0|^4.0|^5.0" }, "require-dev": { - "phpunit/phpunit": "^4.8|^5.0", + "phpunit/phpunit": "^8.0|^9.0", "jmikola/wildcard-event-dispatcher": "~1.0" }, "autoload": { diff --git a/tests/BaseTest.php b/tests/BaseTest.php index 70236e9..9f88d96 100644 --- a/tests/BaseTest.php +++ b/tests/BaseTest.php @@ -3,10 +3,12 @@ use GoetasWebservices\XML\WSDLReader\DefinitionsReader; use GoetasWebservices\XML\WSDLReader\Wsdl\Definitions; +use GoetasWebservices\XML\WSDLReader\Wsdl\TypeNotFoundException; use GoetasWebservices\XML\XSDReader\Schema\Element\ElementDef; use GoetasWebservices\XML\XSDReader\Schema\Type\ComplexType; +use PHPUnit\Framework\TestCase; -class BaseTest extends \PHPUnit_Framework_TestCase +class BaseTest extends TestCase { /** @@ -15,7 +17,7 @@ class BaseTest extends \PHPUnit_Framework_TestCase */ protected $reader; - public function setUp() + public function setUp(): void { $this->reader = new DefinitionsReader(); } @@ -73,11 +75,9 @@ public function testImport() $this->assertNotNull($definitions->findService('StockQuote', 'http://www.example.com')); } - /** - * @expectedException \Exception - */ public function testTypeNotFound() { + $this->expectException(TypeNotFoundException::class); $definitions = $this->reader->readFile(__DIR__ . '/resources/base-wsdl-import.wsdl'); $this->assertNotNull($definitions->findBinding('StockQuoteSoap2', 'http://www.example.com')); } diff --git a/tests/EventsTest.php b/tests/EventsTest.php index 490c9ae..f3c3c27 100644 --- a/tests/EventsTest.php +++ b/tests/EventsTest.php @@ -3,9 +3,10 @@ use GoetasWebservices\XML\WSDLReader\DefinitionsReader; use Jmikola\WildcardEventDispatcher\WildcardEventDispatcher; +use PHPUnit\Framework\TestCase; use Symfony\Component\EventDispatcher\Event; -class EventsTest extends \PHPUnit_Framework_TestCase +class EventsTest extends TestCase { /** @@ -20,7 +21,7 @@ class EventsTest extends \PHPUnit_Framework_TestCase */ protected $dispatcher; - public function setUp() + public function setUp(): void { $this->dispatcher = new WildcardEventDispatcher(); $this->reader = new DefinitionsReader(null, $this->dispatcher); @@ -73,7 +74,7 @@ public function testReadFile() $this->assertCount(count($expected), $events); foreach ($expected as $index => $expectedData) { - list($event, $name) = $events[$index]; + [$event, $name] = $events[$index]; $this->assertInstanceOf('Symfony\Component\EventDispatcher\Event', $event); $this->assertInstanceOf('GoetasWebservices\XML\WSDLReader\Events\WsdlEvent', $event); $this->assertInstanceOf($expectedData[1], $event, "Event name '$expectedData[0]'");