Fix test conflicts between WP_Mock and WordPress unit tests

- Add guards to WP_Mock tests to skip when WP_UnitTestCase is available
- Add guards to WordPress unit tests to skip when WP_UnitTestCase is not available
- Add @group annotations for test separation
This commit is contained in:
2025-11-24 19:41:45 +00:00
parent e8fcc7e1d0
commit bb6de9a3cb
3 changed files with 18 additions and 0 deletions

View File

@@ -3,8 +3,14 @@
* Class AdminTest
*
* @package WPALLSTARS\PluginStarterTemplate
* @group wpmock
*/
// Skip this test file if WP_Mock is not available or WordPress test framework is loaded.
if ( ! class_exists( 'WP_Mock' ) || class_exists( 'WP_UnitTestCase' ) ) {
return;
}
use WPALLSTARS\PluginStarterTemplate\Admin\Admin;
use WPALLSTARS\PluginStarterTemplate\Core;

View File

@@ -3,8 +3,14 @@
* Class CoreTest
*
* @package WPALLSTARS\PluginStarterTemplate
* @group wpmock
*/
// Skip this test file if WP_Mock is not available or WordPress test framework is loaded.
if ( ! class_exists( 'WP_Mock' ) || class_exists( 'WP_UnitTestCase' ) ) {
return;
}
use WPALLSTARS\PluginStarterTemplate\Core;
/**

View File

@@ -3,8 +3,14 @@
* Class MultisiteTest
*
* @package WP_Plugin_Starter_Template_For_AI_Coding
* @group wordpress
*/
// Skip this test file if WordPress test framework is not available.
if ( ! class_exists( 'WP_UnitTestCase' ) ) {
return;
}
/**
* Sample test case for the Multisite class.
*/