Completed
Pull Request — master (#15)
by Marin
03:51 queued 02:28
created

WpHydraConstructTest::tearDown()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Contains tests for WP_Hydra::_construct()
4
 *
5
 * @package wp-hydra
6
 */
7
8
/**
9
 * Tests for WP_Hydra::_construct()
10
 */
11
class WpHydraConstructTest extends WP_UnitTestCase {
12
13
	/**
14
	 * Test setup.
15
	 */
16
	public function setUp() {
17
		$this->wp_hydra = $this->getMockBuilder( 'WP_Hydra' )->getMock();
18
	}
19
20
	/**
21
	 * Test teardown.
22
	 */
23
	public function tearDown() {
24
		unset( $this->wp_hydra );
25
	}
26
27
	/**
28
	 * Tests whether filters are properly registered.
29
	 *
30
	 * @covers WP_Hydra::__construct
31
	 */
32
	public function testHooksRegistered() {
33
		$this->wp_hydra->__construct();
34
35
		$this->assertSame( 1, has_filter( 'option_blogname', array( $this->wp_hydra, 'setup_domain' ) ) );
36
		$this->assertSame( 1, has_filter( 'option_siteurl', array( $this->wp_hydra, 'setup_domain' ) ) );
37
		$this->assertSame( 1, has_filter( 'option_home', array( $this->wp_hydra, 'setup_domain' ) ) );
38
		$this->assertSame( 1, has_filter( 'stylesheet_uri', array( $this->wp_hydra, 'setup_domain' ) ) );
39
		$this->assertSame( 1, has_filter( 'stylesheet_directory_uri', array( $this->wp_hydra, 'setup_domain' ) ) );
40
		$this->assertSame( 1, has_filter( 'template_directory_uri', array( $this->wp_hydra, 'setup_domain' ) ) );
41
42
		$this->assertSame( 10, has_filter( 'the_content', array( $this->wp_hydra, 'setup_content' ) ) );
43
44
		$this->assertSame( 10, has_filter( 'widget_text', array( $this->wp_hydra, 'setup_content' ) ) );
45
46
		$this->assertSame( 10, has_filter( 'upload_dir', array( $this->wp_hydra, 'setup_upload_dir' ) ) );
47
48
		$this->assertSame( 10, has_filter( 'wp_hydra_domain', array( $this->wp_hydra, 'setup_domain' ) ) );
49
50
		$this->assertSame( 10, has_filter( 'wp_hydra_content', array( $this->wp_hydra, 'setup_content' ) ) );
51
	}
52
53
}
54