Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions tests/phpunit/tests/formatting/urlencodeDeep.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
<?php

/**
* Tests for urlencode_deep(), rawurlencode_deep(), and urldecode_deep().
*
* @group formatting
* @ticket 22300
*
* @covers ::urlencode_deep
* @covers ::rawurlencode_deep

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot already flagged this, and I can confirm it: this replaces the existing urlencode_deep() tests from #22300, so that function loses its direct coverage. When I switched urlencode_deep() to rawurlencode locally, the whole class still passed. Could you keep the original tests, the data provider and @covers ::urlencode_deep, and add the new ones next to them?

* @covers ::urldecode_deep
*/
class Tests_Formatting_UrlencodeDeep extends WP_UnitTestCase {

Expand Down Expand Up @@ -44,4 +48,23 @@ public function test_urlencode_deep_should_encode_all_values_in_array() {

$this->assertSame( $expected, urlencode_deep( $actual ) );
}

/**
* Tests that rawurlencode_deep() encodes a single string.
*
* @ticket 65819
*/
public function test_rawurlencode_deep_string() {
$this->assertSame( 'foo%20bar%26baz%3D1', rawurlencode_deep( 'foo bar&baz=1' ) );
}

/**
* Tests that urldecode_deep() decodes a single string.
*
* @ticket 65819
*/
public function test_urldecode_deep_string() {
$this->assertSame( 'foo bar&baz=1', urldecode_deep( 'foo+bar%26baz%3D1' ) );
$this->assertSame( 'foo bar', urldecode_deep( 'foo%20bar' ) );
}
}
Loading