Skip to content

Commit

Permalink
- flush permalinks on tests
Browse files Browse the repository at this point in the history
- update PageLinkFieldTest to test against pretty permalinks
  • Loading branch information
jasonbahl committed Jun 25, 2024
1 parent 081b559 commit 2f18aa2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions tests/_support/WPUnit/WPGraphQLAcfTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ public function setUp(): void {
$this->clearSchema();
Utils::clear_field_type_registry();

$this->set_permalink_structure( '/%postname%/' );
$active_plugins = get_option( 'active_plugins' );

// whether the tests are being run with ACF pro or not
Expand Down Expand Up @@ -206,6 +207,16 @@ public function setUp(): void {

}

/**
* @param string $structure
*/
public function set_permalink_structure( $structure = '' ) {
global $wp_rewrite;
$wp_rewrite->init();
$wp_rewrite->set_permalink_structure( $structure );
$wp_rewrite->flush_rules();
}

/**
* @return string
*/
Expand Down
2 changes: 1 addition & 1 deletion tests/wpunit/FieldTypes/PageLinkFieldTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function get_acf_clone_fragment(): string {
*/
public function get_expected_clone_value(): array {
return [
'expected-url-goes-here'
'/test-post-title/'
];
}

Expand Down

0 comments on commit 2f18aa2

Please sign in to comment.