Skip to content

Commit

Permalink
refactor remove magic number
Browse files Browse the repository at this point in the history
  • Loading branch information
Bèr Kessels committed Dec 31, 2012
1 parent 8fc23b5 commit 883e64d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion TagadelicTag.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function __ToString() {
$attributes = array();

if (!empty($this->description)) $attributes["title"] = $this->description;
if ($this->weight > 0) $attributes["class"] = "weight-3";
if ($this->weight > 0) $attributes["class"] = "weight-{$this->weight}";

return $this->drupal()->l($this->name, $this->link, $attributes);
}
Expand Down
17 changes: 17 additions & 0 deletions tests/TagadelicTagToStringTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public function test__ToStringHasNoTitle() {

$this->object->__tostring();
}

/**
* @covers tagadelictag::__tostring
*/
Expand All @@ -95,5 +96,21 @@ public function test__ToStringHasWeight() {
$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();
}
}

0 comments on commit 883e64d

Please sign in to comment.