Skip to content

Commit e82ec00

Browse files
authored
add tests
1 parent 9687905 commit e82ec00

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

tests/phpunit/tests/robots.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,28 @@ public function test_wp_robots_non_search_page() {
144144
$this->assertStringNotContainsString( 'noindex', $output );
145145
}
146146

147+
/**
148+
* @ticket 63467
149+
*/
150+
public function test_do_robots_uses_filtered_admin_url_paths() {
151+
$filter = static function ( $url, $path, $blog_id, $scheme ) {
152+
if ( 'admin-ajax.php' === $path ) {
153+
return home_url( '/control/admin-ajax.php', $scheme );
154+
}
155+
156+
return home_url( '/control/', $scheme );
157+
};
158+
159+
add_filter( 'admin_url', $filter, 10, 4 );
160+
161+
$output = get_echo( 'do_robots' );
162+
163+
remove_filter( 'admin_url', $filter, 10 );
164+
165+
$this->assertStringContainsString( "Disallow: /control/\n", $output );
166+
$this->assertStringContainsString( "Allow: /control/admin-ajax.php\n", $output );
167+
}
168+
147169
public function add_noindex_directive( array $robots ) {
148170
$robots['noindex'] = true;
149171
return $robots;

0 commit comments

Comments
 (0)