Skip to content

Commit 6f58394

Browse files
committed
issue #32 - ensure PHP => 8.0.0 tests compatibility
1 parent c65bbef commit 6f58394

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/Utils.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use DOMDocument;
88
use Exception;
99
use InvalidArgumentException;
10+
use ValueError;
1011

1112
class Utils
1213
{
@@ -29,8 +30,8 @@ public static function getFormattedXml(?string $string, bool $asDomDocument = fa
2930

3031
/**
3132
* @param string $string
32-
* @throws InvalidArgumentException
3333
* @return DOMDocument
34+
* @throws InvalidArgumentException|ValueError
3435
*/
3536
public static function getDOMDocument(string $string): DOMDocument
3637
{

tests/UtilsTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use DOMDocument;
88
use InvalidArgumentException;
9+
use ValueError;
910
use WsdlToPhp\PackageBase\Utils;
1011

1112
class UtilsTest extends TestCase
@@ -22,14 +23,14 @@ public function testGetFormattedXmlAsDomDocument()
2223

2324
public function testGetFormattedXmlEmptyStringAsString()
2425
{
25-
$this->expectException(InvalidArgumentException::class);
26+
$this->expectException(-1 === version_compare(PHP_VERSION, '8.0.0') ? InvalidArgumentException::class : ValueError::class);
2627

2728
Utils::getFormattedXml('');
2829
}
2930

3031
public function testGetFormattedXmlEmptyStringAsDomDocument()
3132
{
32-
$this->expectException(InvalidArgumentException::class);
33+
$this->expectException(-1 === version_compare(PHP_VERSION, '8.0.0') ? InvalidArgumentException::class : ValueError::class);
3334

3435
Utils::getFormattedXml('', true);
3536
}
@@ -58,7 +59,7 @@ public function testGetDOMDocument()
5859

5960
public function testGetDOMDocumentException()
6061
{
61-
$this->expectException(InvalidArgumentException::class);
62+
$this->expectException(-1 === version_compare(PHP_VERSION, '8.0.0') ? InvalidArgumentException::class : ValueError::class);
6263

6364
$this->assertInstanceOf(DOMDocument::class, Utils::getDOMDocument(''));
6465
}

0 commit comments

Comments
 (0)