Browse Source

ZF-11643: Add support for sizes attribute in Zend_View_Helper_HeadLink

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@24858 44c647ce-9c0f-0410-b52a-842ac1e357ba
adamlundrigan 13 years ago
parent
commit
5482b4ed24
2 changed files with 32 additions and 1 deletions
  1. 13 1
      library/Zend/View/Helper/HeadLink.php
  2. 19 0
      tests/Zend/View/Helper/HeadLinkTest.php

+ 13 - 1
library/Zend/View/Helper/HeadLink.php

@@ -40,7 +40,19 @@ class Zend_View_Helper_HeadLink extends Zend_View_Helper_Placeholder_Container_S
      *
      * @var array
      */
-    protected $_itemKeys = array('charset', 'href', 'hreflang', 'id', 'media', 'rel', 'rev', 'type', 'title', 'extras');
+    protected $_itemKeys = array(
+        'charset',
+        'href',
+        'hreflang',
+        'id',
+        'media',
+        'rel',
+        'rev',
+        'type',
+        'title',
+        'extras',
+        'sizes',
+    );
 
     /**
      * @var string registry key

+ 19 - 0
tests/Zend/View/Helper/HeadLinkTest.php

@@ -477,6 +477,25 @@ class Zend_View_Helper_HeadLinkTest extends PHPUnit_Framework_TestCase
         $this->assertEquals(1, substr_count($this->helper->toString(), "rel=\""));
         $this->assertContains('rel="stylesheet/less"', $this->helper->toString());
     }
+
+    /**
+     * @group ZF-11643
+     */
+    public function testSizesAttributeIsSupported()
+    {
+        $this->helper->headLink(
+            array(
+                 'rel'   => 'icon',
+                 'href'  => 'favicon.png',
+                 'sizes' => '16x16',
+                 'type'  => 'image/png',
+            )
+        );
+
+        $expected = '<link href="favicon.png" rel="icon" type="image/png" sizes="16x16" >';
+
+        $this->assertEquals($expected, $this->helper->toString());
+    }
 }
 
 // Call Zend_View_Helper_HeadLinkTest::main() if this source file is executed directly.