Permalink
Browse files

l() expects third parameter to be nested array, not the attributes.

  • Loading branch information...
1 parent 883e64d commit 76143af796b06e76b5bff8d9b06f0de4edaf1958 Bèr Kessels committed Dec 31, 2012
Showing with 6 additions and 4 deletions.
  1. +4 −2 TagadelicTag.php
  2. +2 −2 tests/TagadelicTagToStringTest.php
View
@@ -34,12 +34,14 @@ function __construct($id, $name, $count) {
public function __ToString() {
$this->clean();
- $attributes = array();
+ $attributes = $options = array();
if (!empty($this->description)) $attributes["title"] = $this->description;
if ($this->weight > 0) $attributes["class"] = "weight-{$this->weight}";
- return $this->drupal()->l($this->name, $this->link, $attributes);
+ if (!empty($attributes)) $options["attributes"] = $attributes;
+
+ return $this->drupal()->l($this->name, $this->link, $options);
}
/**
@@ -55,7 +55,7 @@ public function test__ToStringHasTitle() {
->with(
$this->anything(),
$this->anything(),
- $this->equalto($expected_attrs))
+ $this->equalto(array("attributes" => $expected_attrs)))
->will($this->returnvalue(""));
$this->object->__tostring();
@@ -90,7 +90,7 @@ public function test__ToStringHasWeight() {
->with(
$this->anything(),
$this->anything(),
- $this->equalto($expected_attrs))
+ $this->equalto(array("attributes" => $expected_attrs)))
->will($this->returnvalue(""));
$this->object->__tostring();

0 comments on commit 76143af

Please sign in to comment.