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

WpHydraIsSslTest::setUp()   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::is_ssl()
4
 *
5
 * @package wp-hydra
6
 */
7
8
/**
9
 * Tests for WP_Hydra::is_ssl()
10
 */
11
class WpHydraIsSslTest extends WP_UnitTestCase {
12
	/**
13
	 * Test setup
14
	 */
15
	public function setUp() {
16
		$this->wp_hydra = $this->getMockBuilder( 'WP_Hydra' )->setMethods( null )->getMock();
17
	}
18
19
	/**
20
	 * Test teardown
21
	 */
22
	public function tearDown() {
23
		unset( $this->wp_hydra );
24
	}
25
26
	/**
27
	 * Test when SSL is disabled.
28
	 *
29
	 * @covers WP_Hydra::is_ssl
30
	 */
31
	public function testWithSslDisabled() {
32
		$_SERVER['HTTPS'] = 0;
33
		$this->assertFalse( $this->wp_hydra->is_ssl() );
34
35
		$_SERVER['HTTPS'] = false;
36
		$this->assertFalse( $this->wp_hydra->is_ssl() );
37
	}
38
39
	/**
40
	 * Test when SSL is enabled.
41
	 *
42
	 * @covers WP_Hydra::is_ssl
43
	 */
44
	public function testWithSslEnabled() {
45
		$_SERVER['HTTPS'] = 1;
46
		$this->assertTrue( $this->wp_hydra->is_ssl() );
47
48
		$_SERVER['HTTPS'] = 'on';
49
		$this->assertTrue( $this->wp_hydra->is_ssl() );
50
	}
51
52
}
53