forked from WordPress/wordpress-develop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwp.php
More file actions
37 lines (29 loc) · 957 Bytes
/
wp.php
File metadata and controls
37 lines (29 loc) · 957 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
/**
* @group wp
*/
class Tests_WP extends WP_UnitTestCase {
/**
* @var WP
*/
protected $wp;
public function setUp() {
$this->wp = new WP();
}
public function test_add_query_var() {
$public_qv_count = count( $this->wp->public_query_vars );
$this->wp->add_query_var( 'test' );
$this->wp->add_query_var( 'test2' );
$this->wp->add_query_var( 'test' );
$this->assertSame( $public_qv_count + 2, count( $this->wp->public_query_vars ) );
$this->assertTrue( in_array( 'test', $this->wp->public_query_vars ) );
$this->assertTrue( in_array( 'test2', $this->wp->public_query_vars ) );
}
public function test_remove_query_var() {
$public_qv_count = count( $this->wp->public_query_vars );
$this->wp->add_query_var( 'test' );
$this->assertTrue( in_array( 'test', $this->wp->public_query_vars ) );
$this->wp->remove_query_var( 'test' );
$this->assertSame( $public_qv_count, count( $this->wp->public_query_vars ) );
}
}