diff --git a/tests/phpunit/tests/functions/wp_nonce_url.php b/tests/phpunit/tests/functions/wp_nonce_url.php new file mode 100644 index 0000000000000..fc474781fc902 --- /dev/null +++ b/tests/phpunit/tests/functions/wp_nonce_url.php @@ -0,0 +1,52 @@ +assertMatchesRegularExpression( $expected, wp_nonce_url( $actionurl, $action, $name ) ); + } + + public function data_wp_nonce_url() { + return array( + array( + 'expected' => '/^http:\/\/example\.org\/\?_wpnonce=.{10}$/', + 'actionurl' => 'http://example.org/', + 'action' => '12345', + 'name' => '_wpnonce', + ), + array( + 'expected' => '/^https:\/\/example\.org\/\?my_nonce=.{10}$/', + 'actionurl' => 'https://example.org/', + 'action' => '12345', + 'name' => 'my_nonce', + ), + array( + 'expected' => '/\/\?_wpnonce=.{10}$/', + 'actionurl' => '/', + 'action' => '12345', + 'name' => '_wpnonce', + ), + array( + 'expected' => '/\?_wpnonce=.{10}$/', + 'actionurl' => '/', + ), + ); + } +}