1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
|
From: William Desportes <williamdes@wdes.fr>
Date: Mon, 8 Sep 2025 16:06:05 +0200
Subject: Fix tests for PHPUnit 12
Origin: vendor
Forwarded: https://github.com/pear/Net_URL2/pull/22
---
Net_URL2-2.2.3/tests/Net/URL2Test.php | 58 ++++++++++++++++++-----------------
1 file changed, 30 insertions(+), 28 deletions(-)
diff --git a/Net_URL2-2.2.3/tests/Net/URL2Test.php b/Net_URL2-2.2.3/tests/Net/URL2Test.php
index 9df68bf..ec6c614 100644
--- a/Net_URL2-2.2.3/tests/Net/URL2Test.php
+++ b/Net_URL2-2.2.3/tests/Net/URL2Test.php
@@ -21,7 +21,7 @@
* @version Release: 2.2.3
* @link https://pear.php.net/package/Net_URL2
*/
-class Net_URL2Test extends PHPUnit_Framework_TestCase
+class Net_URL2Test extends PHPUnit\Framework\TestCase
{
/**
* Tests setting a zero-length string and false as authority
@@ -827,28 +827,30 @@ class Net_URL2Test extends PHPUnit_Framework_TestCase
{
return array(
// String equivalence:
- array('http://example.com/', 'http://example.com/'),
+ array('http://example.com/', 'http://example.com/', true),
// Originally first dataset:
- array('http://www.example.com/%9a', 'http://www.example.com/%9A'),
+ array('http://www.example.com/%9a', 'http://www.example.com/%9A', false),
// Example from RFC 3986 6.2.2.:
- array('example://a/b/c/%7Bfoo%7D', 'eXAMPLE://a/./b/../b/%63/%7bfoo%7d'),
+ array('example://a/b/c/%7Bfoo%7D', 'eXAMPLE://a/./b/../b/%63/%7bfoo%7d', false),
// Example from RFC 3986 6.2.2.1.:
- array('HTTP://www.EXAMPLE.com/', 'http://www.example.com/'),
+ array('HTTP://www.EXAMPLE.com/', 'http://www.example.com/', false),
// Example from RFC 3986 6.2.3.:
array(
- 'http://example.com', 'http://example.com/',
- 'http://example.com:/', 'http://example.com:80/'
+ 'http://example.com', 'http://example.com/', false
+ ),
+ array(
+ 'http://example.com:/', 'http://example.com:80/', false
),
// Bug #20161: URLs with "0" as host fail to normalize with empty path
- array('http://0/', 'http://0'),
+ array('http://0/', 'http://0', false),
// Bug #20473: Normalize query and fragment broken
- array('foo:///?%66%6f%6f#%62%61%72', 'foo:///?foo#bar'),
+ array('foo:///?%66%6f%6f#%62%61%72', 'foo:///?foo#bar', false),
);
}
@@ -861,22 +863,19 @@ class Net_URL2Test extends PHPUnit_Framework_TestCase
* @dataProvider provideEquivalentUrlLists
*/
#[PHPUnit\Framework\Attributes\DataProvider('provideEquivalentUrlLists')]
- public function testNormalize()
+ public function testNormalize(string $urlOne, string $urlTwo, bool $identical)
{
- $urls = func_get_args();
+ $urlOne = new Net_Url2($urlOne);
+ $urlTwo = new Net_Url2($urlTwo);
- $this->assertGreaterThanOrEqual(2, count($urls));
+ if (! $identical) {
+ $this->assertNotSame($urlOne->__toString(), $urlTwo->__toString());
+ }
- $last = null;
+ $urlOne->normalize();
+ $urlTwo->normalize();
- foreach ($urls as $index => $url) {
- $url = new Net_Url2($url);
- $url->normalize();
- if ($index) {
- $this->assertSame((string)$last, (string)$url);
- }
- $last = $url;
- }
+ $this->assertSame($urlOne->__toString(), $urlTwo->__toString());
}
/**
@@ -952,14 +951,17 @@ class Net_URL2Test extends PHPUnit_Framework_TestCase
* @return void
*/
#[PHPUnit\Framework\Attributes\DataProvider('provideEquivalentUrlLists')]
- public function testConstructSelf()
+ public function testConstructSelf(string $urlOne, string $urlTwo, bool $identical)
{
- $urls = func_get_args();
- foreach ($urls as $url) {
- $urlA = new Net_URL2($url);
- $urlB = new Net_URL2($urlA);
- $this->assertSame((string)$urlA, (string)$urlB);
- }
+ $urlOne = new Net_Url2($urlOne);
+ $urlOneExtended = new Net_Url2($urlOne);
+
+ $this->assertSame($urlOne->__toString(), $urlOneExtended->__toString());
+
+ $urlTwo = new Net_Url2($urlTwo);
+ $urlTwoExtended = new Net_Url2($urlTwo);
+
+ $this->assertSame($urlTwo->__toString(), $urlTwoExtended->__toString());
}
/**
|