HtmlTest   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 108
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 108
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A testHtml() 0 15 1
A testAppend() 0 15 1
A testPrepend() 0 15 1
A testClear() 0 16 1
1
<?php
2
namespace Redaxscript\Tests\Html;
3
4
use Redaxscript\Html;
5
use Redaxscript\Tests\TestCaseAbstract;
6
7
/**
8
 * HtmlTest
9
 *
10
 * @since 2.6.0
11
 *
12
 * @package Redaxscript
13
 * @category Tests
14
 * @author Henry Ruhs
15
 *
16
 * @covers Redaxscript\Html\HtmlAbstract
17
 */
18
19
class HtmlTest extends TestCaseAbstract
20
{
21
	/**
22
	 * testHtml
23
	 *
24
	 * @since 2.6.0
25
	 *
26
	 * @param string $html
27
	 * @param string $expect
28
	 *
29
	 * @dataProvider providerAutoloader
30
	 */
31
32
	public function testHtml(string $html = null, string $expect = null) : void
33
	{
34
		/* setup */
35
36
		$element = new Html\Element();
37
		$element->init('a');
38
39
		/* actual */
40
41
		$actual = $element->html($html);
42
43
		/* compare */
44
45
		$this->assertEquals($expect, $actual);
46
	}
47
48
	/**
49
	 * testAppend
50
	 *
51
	 * @since 2.6.0
52
	 *
53
	 * @param string $html
54
	 * @param string $append
55
	 * @param string $expect
56
	 *
57
	 * @dataProvider providerAutoloader
58
	 */
59
60
	public function testAppend(string $html = null, string $append = null, string $expect = null) : void
61
	{
62
		/* setup */
63
64
		$element = new Html\Element();
65
		$element->init('div')->html($html);
66
67
		/* actual */
68
69
		$actual = $element->append($append);
70
71
		/* compare */
72
73
		$this->assertEquals($expect, $actual);
74
	}
75
76
	/**
77
	 * testPrepend
78
	 *
79
	 * @since 2.6.0
80
	 *
81
	 * @param string $html
82
	 * @param string $prepend
83
	 * @param string $expect
84
	 *
85
	 * @dataProvider providerAutoloader
86
	 */
87
88
	public function testPrepend(string $html = null, string $prepend = null, string $expect = null) : void
89
	{
90
		/* setup */
91
92
		$element = new Html\Element();
93
		$element->init('div')->html($html);
94
95
		/* actual */
96
97
		$actual = $element->prepend($prepend);
98
99
		/* compare */
100
101
		$this->assertEquals($expect, $actual);
102
	}
103
104
	/**
105
	 * testClear
106
	 *
107
	 * @since 3.0.0
108
	 */
109
110
	public function testClear() : void
111
	{
112
		/* setup */
113
114
		$element = new Html\Element();
115
		$element->init('a');
116
117
		/* expect and actual */
118
119
		$expect = '<a></a>';
120
		$actual = $element->text('test')->clear();
121
122
		/* compare */
123
124
		$this->assertEquals($expect, $actual);
125
	}
126
}
127