Skip to content

Commit 68a2989

Browse files
committed
Enforce the default permalink style in testing
1 parent 0036f10 commit 68a2989

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tests/wp-includes/rest-api/auth/class-test-wp-rest-key-pair.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ public function setUp() {
6969

7070
$this->user_id = $this->factory->user->create( $user_data );
7171
$this->user = get_user_by( 'id', $this->user_id );
72+
73+
// Enforce the expected permalink style
74+
add_filter( 'default_option_permalink_structure', [ $this, 'defaultPermalinkStyle' ], 10, 0 );
7275
}
7376

7477
/**
@@ -82,6 +85,7 @@ public function tearDown() {
8285
$this->user_id = null;
8386
$this->user = null;
8487
unset( $GLOBALS['wp_rest_server'] );
88+
remove_filter( 'default_option_permalink_structure', [ $this, 'defaultPermalinkStyle' ], 10 );
8589
parent::tearDown();
8690
}
8791

@@ -110,6 +114,10 @@ public function test_get_rest_uri() {
110114
$this->assertEquals( '/wp-json/wp/v2/key-pair', WP_REST_Key_Pair::get_rest_uri() );
111115
}
112116

117+
public function defaultPermalinkStyle() {
118+
return '/%postname%/';
119+
}
120+
113121
/**
114122
* Test register_routes().
115123
*

0 commit comments

Comments
 (0)