Skip to content

Commit 09ac7f3

Browse files
committed
Restore query and post after test.
1 parent ad80a8e commit 09ac7f3

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

tests/integration/InitOptionsTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ class InitOptionsTest extends TestCase {
1616
public function testAddPageviewProps() {
1717
try {
1818
global $post, $wp_query;
19+
$old_post = $post;
20+
$old_query = $wp_query;
1921

2022
$post_id = wp_insert_post(
2123
[
@@ -42,8 +44,8 @@ public function testAddPageviewProps() {
4244
$this->assertArrayHasKey( 'category', $options['customProperties'] );
4345
$this->assertEquals( 'Uncategorized', $options['customProperties']['category'] );
4446
} finally {
45-
$post = null;
46-
$wp_query = null;
47+
$post = $old_post;
48+
$wp_query = $old_query;
4749
remove_filter( 'plausible_analytics_settings', [ $this, 'enablePageviewProps' ] );
4850
}
4951
}

0 commit comments

Comments
 (0)