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:
@@ -3,8 +3,14 @@
|
|||||||
* Class AdminTest
|
* Class AdminTest
|
||||||
*
|
*
|
||||||
* @package WPALLSTARS\PluginStarterTemplate
|
* @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\Admin\Admin;
|
||||||
use WPALLSTARS\PluginStarterTemplate\Core;
|
use WPALLSTARS\PluginStarterTemplate\Core;
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,14 @@
|
|||||||
* Class CoreTest
|
* Class CoreTest
|
||||||
*
|
*
|
||||||
* @package WPALLSTARS\PluginStarterTemplate
|
* @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;
|
use WPALLSTARS\PluginStarterTemplate\Core;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -3,8 +3,14 @@
|
|||||||
* Class MultisiteTest
|
* Class MultisiteTest
|
||||||
*
|
*
|
||||||
* @package WP_Plugin_Starter_Template_For_AI_Coding
|
* @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.
|
* Sample test case for the Multisite class.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user