test(wpmc S4): WP_Query stub + wp_query globals cleanup
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+6
-1
@@ -24,7 +24,12 @@ abstract class TestCase extends BaseTestCase
|
|||||||
|
|
||||||
protected function tearDown(): void
|
protected function tearDown(): void
|
||||||
{
|
{
|
||||||
unset($_SERVER['REQUEST_URI']);
|
unset(
|
||||||
|
$_SERVER['REQUEST_URI'],
|
||||||
|
$GLOBALS['wp_query'],
|
||||||
|
$GLOBALS['wp_the_query'],
|
||||||
|
$GLOBALS['post']
|
||||||
|
);
|
||||||
Monkey\tearDown();
|
Monkey\tearDown();
|
||||||
parent::tearDown();
|
parent::tearDown();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,3 +13,15 @@ require_once __DIR__ . '/../includes/class-plugin.php';
|
|||||||
if (!class_exists('WP_Term', false)) {
|
if (!class_exists('WP_Term', false)) {
|
||||||
eval('class WP_Term { public int $term_id = 0; public string $slug = ""; public string $taxonomy = ""; }');
|
eval('class WP_Term { public int $term_id = 0; public string $slug = ""; public string $taxonomy = ""; }');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!class_exists('WP_Query', false)) {
|
||||||
|
eval('class WP_Query {
|
||||||
|
public array $constructor_args = [];
|
||||||
|
public bool $is_page = false;
|
||||||
|
public bool $is_front_page = false;
|
||||||
|
public bool $is_404 = false;
|
||||||
|
public function __construct($args = []) { $this->constructor_args = is_array($args) ? $args : []; }
|
||||||
|
public function set_404(): void { $this->is_404 = true; }
|
||||||
|
public function set($k, $v): void {}
|
||||||
|
}');
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user