Skip to content

Commit bb78ba8

Browse files
committed
Fix tests for PHPUnit 12
Origin: vendor Forwarded: #22
1 parent c1f2b31 commit bb78ba8

File tree

1 file changed

+29
-27
lines changed

1 file changed

+29
-27
lines changed

tests/Net/URL2Test.php

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -827,28 +827,30 @@ public static function provideEquivalentUrlLists()
827827
{
828828
return array(
829829
// String equivalence:
830-
array('http://example.com/', 'http://example.com/'),
830+
array('http://example.com/', 'http://example.com/', true),
831831

832832
// Originally first dataset:
833-
array('http://www.example.com/%9a', 'http://www.example.com/%9A'),
833+
array('http://www.example.com/%9a', 'http://www.example.com/%9A', false),
834834

835835
// Example from RFC 3986 6.2.2.:
836-
array('example://a/b/c/%7Bfoo%7D', 'eXAMPLE://a/./b/../b/%63/%7bfoo%7d'),
836+
array('example://a/b/c/%7Bfoo%7D', 'eXAMPLE://a/./b/../b/%63/%7bfoo%7d', false),
837837

838838
// Example from RFC 3986 6.2.2.1.:
839-
array('HTTP://www.EXAMPLE.com/', 'http://www.example.com/'),
839+
array('HTTP://www.EXAMPLE.com/', 'http://www.example.com/', false),
840840

841841
// Example from RFC 3986 6.2.3.:
842842
array(
843-
'http://example.com', 'http://example.com/',
844-
'http://example.com:/', 'http://example.com:80/'
843+
'http://example.com', 'http://example.com/', false
844+
),
845+
array(
846+
'http://example.com:/', 'http://example.com:80/', false
845847
),
846848

847849
// Bug #20161: URLs with "0" as host fail to normalize with empty path
848-
array('http://0/', 'http://0'),
850+
array('http://0/', 'http://0', false),
849851

850852
// Bug #20473: Normalize query and fragment broken
851-
array('foo:///?%66%6f%6f#%62%61%72', 'foo:///?foo#bar'),
853+
array('foo:///?%66%6f%6f#%62%61%72', 'foo:///?foo#bar', false),
852854
);
853855
}
854856

@@ -861,22 +863,19 @@ public static function provideEquivalentUrlLists()
861863
* @dataProvider provideEquivalentUrlLists
862864
*/
863865
#[PHPUnit\Framework\Attributes\DataProvider('provideEquivalentUrlLists')]
864-
public function testNormalize()
866+
public function testNormalize(string $urlOne, string $urlTwo, bool $identical)
865867
{
866-
$urls = func_get_args();
868+
$urlOne = new Net_Url2($urlOne);
869+
$urlTwo = new Net_Url2($urlTwo);
867870

868-
$this->assertGreaterThanOrEqual(2, count($urls));
871+
if (! $identical) {
872+
$this->assertNotSame($urlOne->__toString(), $urlTwo->__toString());
873+
}
869874

870-
$last = null;
875+
$urlOne->normalize();
876+
$urlTwo->normalize();
871877

872-
foreach ($urls as $index => $url) {
873-
$url = new Net_Url2($url);
874-
$url->normalize();
875-
if ($index) {
876-
$this->assertSame((string)$last, (string)$url);
877-
}
878-
$last = $url;
879-
}
878+
$this->assertSame($urlOne->__toString(), $urlTwo->__toString());
880879
}
881880

882881
/**
@@ -952,14 +951,17 @@ public function testComponentRecompositionAndNormalization($uri)
952951
* @return void
953952
*/
954953
#[PHPUnit\Framework\Attributes\DataProvider('provideEquivalentUrlLists')]
955-
public function testConstructSelf()
954+
public function testConstructSelf(string $urlOne, string $urlTwo, bool $identical)
956955
{
957-
$urls = func_get_args();
958-
foreach ($urls as $url) {
959-
$urlA = new Net_URL2($url);
960-
$urlB = new Net_URL2($urlA);
961-
$this->assertSame((string)$urlA, (string)$urlB);
962-
}
956+
$urlOne = new Net_Url2($urlOne);
957+
$urlOneExtended = new Net_Url2($urlOne);
958+
959+
$this->assertSame($urlOne->__toString(), $urlOneExtended->__toString());
960+
961+
$urlTwo = new Net_Url2($urlTwo);
962+
$urlTwoExtended = new Net_Url2($urlTwo);
963+
964+
$this->assertSame($urlTwo->__toString(), $urlTwoExtended->__toString());
963965
}
964966

965967
/**

0 commit comments

Comments
 (0)