Skip to content

Commit

Permalink
Skip tests if do_tabbed_settings_sections() is being defined elsewher…
Browse files Browse the repository at this point in the history
…e (such as within WordPress core)
  • Loading branch information
stevegrunwell committed Aug 21, 2020
1 parent 0f0e46a commit 62f826a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/test-tabbed-settings-sections.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,19 @@ public function setUp() {

$wp_settings_sections = array();

// Skip the tests if do_tabbed_settings_sections() is defined in WordPress core.
if ( function_exists( 'do_tabbed_settings_sections' ) ) {
$function = new \ReflectionFunction( 'do_tabbed_settings_sections' );
$filename = dirname( __DIR__ ) . '/wp-admin-tabbed-settings-pages.php';

if ( $filename !== $function->getFileName() ) {
$this->markTestSkipped(
'do_tabbed_settings_sections() has been defined somewhere besides %1$s, skipping test.',
$filename
);
}
}

/*
* In order to prevent conflicts with WordPress core should do_tabbed_settings_sections()
* make it in, don't load the plugin in the test suite until we reach this point.
Expand Down

0 comments on commit 62f826a

Please sign in to comment.