class TagadelicTagToStringTest in Tagadelic 7.2
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
Hierarchy
- class \TagadelicTagTest extends \PHPUnit_Framework_TestCase
- class \TagadelicTagToStringTest
Expanded class hierarchy of TagadelicTagToStringTest
File
- tests/
TagadelicTagToStringTest.php, line 15
View source
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();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
TagadelicTagTest:: |
protected | property | ||
TagadelicTagTest:: |
protected | function | Tears down the fixture, for example, closes a network connection. This method is called after a test is executed. | |
TagadelicTagToStringTest:: |
protected | function |
Sets up the fixture, for example, opens a network connection.
This method is called before a test is executed. Overrides TagadelicTagTest:: |
|
TagadelicTagToStringTest:: |
public | function | @covers TagadelicTag::__ToString | |
TagadelicTagToStringTest:: |
public | function | @covers tagadelictag::__tostring | |
TagadelicTagToStringTest:: |
public | function | @covers tagadelictag::__tostring | |
TagadelicTagToStringTest:: |
public | function | @covers tagadelictag::__tostring | |
TagadelicTagToStringTest:: |
public | function | @covers tagadelictag::__tostring | |
TagadelicTagToStringTest:: |
public | function | @covers tagadelictag::__tostring |