Skip to content

Commit

Permalink
Merge branch 'weierophinney-hotfix/4105' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
ezimuel committed Jul 22, 2013
2 parents ecc7972 + c5699d3 commit d064326
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
15 changes: 15 additions & 0 deletions library/Zend/View/Helper/HeadLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,21 @@ public function __construct()
$this->setSeparator(PHP_EOL);
}

/**
* Proxy to __invoke()
*
* Allows calling $helper->headLink(), but, more importantly, chaining calls
* like ->appendStylesheet()->headLink().
*
* @param array $attributes
* @param string $placement
* @return HeadLink
*/
public function headLink(array $attributes = null, $placement = Placeholder\Container\AbstractContainer::APPEND)
{
return call_user_func_array(array($this, '__invoke'), func_get_args());
}

/**
* headLink() - View Helper Method
*
Expand Down
8 changes: 4 additions & 4 deletions tests/ZendTest/View/Helper/HeadLinkTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,16 @@ public function testOffsetSetThrowsExceptionWithoutArrayArgument()
$this->helper->offsetSet(1, 'foo');
}

public function testCreatingLinkStackViaHeadScriptCreatesAppropriateOutput()
public function testCreatingLinkStackViaHeadLinkCreatesAppropriateOutput()
{
$links = array(
'link1' => array('rel' => 'stylesheet', 'type' => 'text/css', 'href' => 'foo'),
'link2' => array('rel' => 'stylesheet', 'type' => 'text/css', 'href' => 'bar'),
'link3' => array('rel' => 'stylesheet', 'type' => 'text/css', 'href' => 'baz'),
);
$this->helper->__invoke($links['link1'])
->__invoke($links['link2'], 'PREPEND')
->__invoke($links['link3']);
$this->helper->headLink($links['link1'])
->headLink($links['link2'], 'PREPEND')
->headLink($links['link3']);

$string = $this->helper->toString();
$lines = substr_count($string, PHP_EOL);
Expand Down

0 comments on commit d064326

Please sign in to comment.