/
TagadelicTagToStringTest.php
116 lines (98 loc) · 2.85 KB
/
TagadelicTagToStringTest.php
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<?php
require_once "TagadelicTagTest.php";
/**
* Class Tagadelictagtostringtest
*
* Test-group for testing the output-method __ToString from TagadelicTagTest.
* This is a functional group, with lots of duplication, hence it is extracted
* to its own Test.
*
* @TODO: find a way to stub a basic implementation and then
* override that http://stackoverflow.com/q/14100185/73673
*/
class TagadelicTagToStringTest extends TagadelicTagTest {
protected function setUp() {
parent::setUp();
$this->drupal->expects($this->once())
->method('l')
->will($this->returnValue("<a>blackbeard</a>"));
}
/**
* @covers TagadelicTag::__ToString
*/
public function test__ToString() {
$this->assertTag(array("tag" => "a", "content" => "blackbeard"), $this->object->__ToString());
}
/**
* @covers tagadelictag::__tostring
*/
public function test__ToStringHasLink() {
$link = '/foo/bar';
$this->object->set_link($link);
$this->drupal->expects($this->any())
->method('l')
->with(
$this->anything(),
$this->equalto($link),
$this->anything());
$this->object->__tostring();
}
/**
* @covers tagadelictag::__tostring
*/
public function test__ToStringHasTitle() {
$this->object->set_description("Foo Bar");
$expected_attrs = array("title" => "Foo Bar");
$this->drupal->expects($this->any())
->method('l')
->with(
$this->anything(),
$this->anything(),
$this->equalto(array("attributes" => $expected_attrs)))
->will($this->returnvalue(""));
$this->object->__tostring();
}
/**
* @covers tagadelictag::__tostring
*/
public function test__ToStringHasNoTitle() {
$this->object->set_description("");
$this->drupal->expects($this->any())
->method('l')
->with(
$this->anything(),
$this->anything(),
$this->equalto(array()))
->will($this->returnvalue(""));
$this->object->__tostring();
}
/**
* @covers tagadelictag::__tostring
*/
public function test__ToStringHasWeight() {
$this->object->set_weight(3);
$expected_attrs = array("class" => array("level3"));
$this->drupal->expects($this->any())
->method('l')
->with(
$this->anything(),
$this->anything(),
$this->equalto(array("attributes" => $expected_attrs)))
->will($this->returnvalue(""));
$this->object->__tostring();
}
/**
* @covers tagadelictag::__tostring
*/
public function test__ToStringHasNoWeight() {
$this->object->set_weight(0);
$this->drupal->expects($this->any())
->method('l')
->with(
$this->anything(),
$this->anything(),
$this->equalto(array()))
->will($this->returnvalue(""));
$this->object->__tostring();
}
}