Skip to content

Commit

Permalink
Tests: fix PHPUnit deprecation notices [3]
Browse files Browse the repository at this point in the history
Make sure data providers only pass the arguments supported by the test.

This fixes a number of PHPUnit (10.5+) deprecation notices along the lines of "Providing invalid named argument $* for method WpOrg\Requests\Tests\*\*Test::test*() is deprecated and will not be supported in PHPUnit 11.0.".
  • Loading branch information
jrfnl committed Jun 3, 2024
1 parent 39f5506 commit 1f45ea4
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions tests/Cookie/Jar/NormalizeCookieTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ final class NormalizeCookieTest extends TestCase {
/**
* Verify that cookie normalization works on both prebaked and unbaked cookies when not passing a key.
*
* @dataProvider dataNormalization
* @dataProvider dataNormalizationWithoutKey
*
* @param mixed $cookie Cookie header value, possibly pre-parsed (object).
*
Expand All @@ -30,10 +30,25 @@ public function testNormalizationWithoutKey($cookie) {
$this->assertSame(self::COOKIE_VALUE, (string) $result, 'Cookie value is not the expected value');
}

/**
* Data provider.
*
* @return array
*/
public static function dataNormalizationWithoutKey() {
$data = self::dataNormalizationWithKey();

foreach ($data as $set_name => $set_value) {
unset($data[$set_name]['expected_name']);
}

return $data;
}

/**
* Verify that cookie normalization works on both prebaked and unbaked cookies when passing a key.
*
* @dataProvider dataNormalization
* @dataProvider dataNormalizationWithKey
*
* @param mixed $cookie Cookie header value, possibly pre-parsed (object).
*
Expand All @@ -55,7 +70,7 @@ public function testNormalizationWithKey($cookie, $expected_name) {
*
* @return array
*/
public static function dataNormalization() {
public static function dataNormalizationWithKey() {
return [
'unbaked cookie (string)' => [
'cookie' => self::COOKIE_VALUE,
Expand Down

0 comments on commit 1f45ea4

Please sign in to comment.