Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

refactor remove magic number

  • Loading branch information...
commit 883e64d98423fe90027a86fe4b9e30cb906cc127 1 parent 8fc23b5
Bèr Kessels authored
Showing with 18 additions and 1 deletion.
  1. +1 −1  TagadelicTag.php
  2. +17 −0 tests/TagadelicTagToStringTest.php
2  TagadelicTag.php
View
@@ -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);
}
17 tests/TagadelicTagToStringTest.php
View
@@ -77,6 +77,7 @@ public function test__ToStringHasNoTitle() {
$this->object->__tostring();
}
+
/**
* @covers tagadelictag::__tostring
*/
@@ -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();
+ }
}
Please sign in to comment.
Something went wrong with that request. Please try again.