Skip to content

Commit

Permalink
Fixes zendframework#488 - Zend_Dojo_View_Helper_Dojo_Container setCdn…
Browse files Browse the repository at this point in the history
…Version
  • Loading branch information
froschdesign authored and Dimitris Giotas committed Jun 17, 2016
1 parent 1dde220 commit 04e2f1a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion library/Zend/Dojo/View/Helper/Dojo/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ public function getCdnBase()
public function setCdnVersion($version = null)
{
$this->enable();
if (preg_match('/^[1-9]\.[0-9](\.[0-9])?$/', $version)) {
if (preg_match('/^[1-9]\.[0-9]{1,2}(\.[0-9]{1,2})?$/', $version)) {
$this->_cdnVersion = $version;
}
return $this;
Expand Down
18 changes: 18 additions & 0 deletions tests/Zend/Dojo/View/Helper/DojoTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,24 @@ public function testShouldAllowSpecifyingDojoVersionWhenUtilizingCdn()
$this->assertEquals('1.0', $this->helper->getCdnVersion());
}

/**
* @group GH-488
*/
public function testSetCdnVersionForHigherMinorReleases()
{
$this->helper->setCdnVersion('1.10');
$this->assertEquals('1.10', $this->helper->getCdnVersion());
}

/**
* @group GH-488
*/
public function testSetCdnVersionForHigherMiniReleases()
{
$this->helper->setCdnVersion('1.10.29');
$this->assertEquals('1.10.29', $this->helper->getCdnVersion());
}

public function testShouldUseAolCdnDojoPathByDefault()
{
$this->assertEquals(Zend_Dojo::CDN_DOJO_PATH_AOL, $this->helper->getCdnDojoPath());
Expand Down

0 comments on commit 04e2f1a

Please sign in to comment.