mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
This replaces instances of `assertTrue( in_array( ... ) )` with `assertContains()` to use native PHPUnit functionality. Follow-up to [51335], [51337], [51367], [51397], [51403]. Props hellofromTonya, jrf, SergeyBiryukov. Fixes #53123. See #53363. git-svn-id: https://develop.svn.wordpress.org/trunk@51404 602fd350-edb4-49c9-b593-d223f7449a82
39 lines
936 B
PHP
39 lines
936 B
PHP
<?php
|
|
|
|
/**
|
|
* @group wp
|
|
*/
|
|
class Tests_WP extends WP_UnitTestCase {
|
|
/**
|
|
* @var WP
|
|
*/
|
|
protected $wp;
|
|
|
|
public function setUp() {
|
|
parent::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->assertCount( $public_qv_count + 2, $this->wp->public_query_vars );
|
|
$this->assertContains( 'test', $this->wp->public_query_vars );
|
|
$this->assertContains( '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->assertContains( 'test', $this->wp->public_query_vars );
|
|
$this->wp->remove_query_var( 'test' );
|
|
|
|
$this->assertCount( $public_qv_count, $this->wp->public_query_vars );
|
|
}
|
|
}
|