Browse Source

returns an empty string with no crumbs

Mirko Pagliai 9 years ago
parent
commit
80ef05afe4

+ 3 - 3
src/View/Helper/BreadcrumbsHelper.php

@@ -235,12 +235,12 @@ class BreadcrumbsHelper extends Helper
      * - *innerAttrs* To provide attributes in case your separator is divided in two elements.
      * All other properties will be converted as HTML attributes and will replace the *attrs* key in the template.
      * If you use the default for this option (empty), it will not render a separator.
-     * @return string|null The breadcrumbs trail
+     * @return string The breadcrumbs trail
      */
     public function render(array $attributes = [], array $separator = [])
     {
-        if (empty($this->crumbs)) {
-            return null;
+        if (!$this->crumbs) {
+            return '';
         }
 
         $crumbs = $this->crumbs;

+ 1 - 1
tests/TestCase/View/Helper/BreadcrumbsHelperTest.php

@@ -357,7 +357,7 @@ class BreadcrumbsHelperTest extends TestCase
      */
     public function testRender()
     {
-        $this->assertEmpty($this->breadcrumbs->render());
+        $this->assertSame('', $this->breadcrumbs->render());
 
         $this->breadcrumbs
             ->add('Home', '/', ['class' => 'first', 'innerAttrs' => ['data-foo' => 'bar']])