Fix: Update test workflow for PHP 7.0 compatibility

This commit is contained in:
2025-04-18 17:42:18 +01:00
parent 3c1db9d4fb
commit 1cf46254b7
6 changed files with 42 additions and 20 deletions

View File

@@ -8,9 +8,7 @@
// First, we need to load the composer autoloader so we can use WP Mock.
require_once dirname(__DIR__) . '/vendor/autoload.php';
// Import WP_Mock class
use WP_Mock\Tools\TestCase;
use WP_Mock;
// No need to import WP_Mock classes here
// Now call the bootstrap method of WP Mock.
WP_Mock::bootstrap();

View File

@@ -7,13 +7,11 @@
use WPALLSTARS\PluginStarterTemplate\Admin\Admin;
use WPALLSTARS\PluginStarterTemplate\Core;
use WP_Mock\Tools\TestCase;
use WP_Mock;
/**
* Admin test case.
*/
class AdminTest extends TestCase {
class AdminTest extends \WP_Mock\Tools\TestCase {
/**
* Test instance
@@ -32,7 +30,7 @@ class AdminTest extends TestCase {
/**
* Set up test environment
*/
public function setUp(): void {
public function setUp() {
parent::setUp();
// Set up mocks
@@ -54,7 +52,7 @@ class AdminTest extends TestCase {
/**
* Tear down test environment
*/
public function tearDown(): void {
public function tearDown() {
WP_Mock::tearDown();
parent::tearDown();
}

View File

@@ -6,13 +6,11 @@
*/
use WPALLSTARS\PluginStarterTemplate\Core;
use WP_Mock\Tools\TestCase;
use WP_Mock;
/**
* Core test case.
*/
class CoreTest extends TestCase {
class CoreTest extends \WP_Mock\Tools\TestCase {
/**
* Test instance
@@ -24,7 +22,7 @@ class CoreTest extends TestCase {
/**
* Set up test environment
*/
public function setUp(): void {
public function setUp() {
parent::setUp();
// Set up mocks
@@ -37,7 +35,7 @@ class CoreTest extends TestCase {
/**
* Tear down test environment
*/
public function tearDown(): void {
public function tearDown() {
WP_Mock::tearDown();
parent::tearDown();
}