Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
Removed old test files for Zend/Cloud/Infrastructure
Browse files Browse the repository at this point in the history
  • Loading branch information
Show file tree
Hide file tree
Showing 16 changed files with 78 additions and 49 deletions.
4 changes: 2 additions & 2 deletions src/AbstractPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
* @category Zend
* @package Zend_Navigation
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand All @@ -35,7 +35,7 @@
* @uses \Zend\Navigation\Page\Uri
* @category Zend
* @package Zend_Navigation
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class AbstractPage extends Container
Expand Down
24 changes: 16 additions & 8 deletions src/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
* @category Zend
* @package Zend_Navigation
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand All @@ -36,7 +36,7 @@
* @uses \Zend\Navigation\AbstractPage
* @category Zend
* @package Zend_Navigation
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Container implements \RecursiveIterator, \Countable
Expand Down Expand Up @@ -150,21 +150,29 @@ public function addPage($page)
/**
* Adds several pages at once
*
* @param array|\Zend\Config\Config $pages pages to add
* @return \Zend\Navigation\Container fluent interface, returns self
* @throws \Zend\Navigation\InvalidArgumentException if $pages is not array
* or \Zend\Config\Config
* @param array|\Zend\Config\Config|\Zend\Navigation\Container $pages pages
* to add
* @return \Zend\Navigation\Container fluent interface, returns self
* @throws \Zend\Navigation\InvalidArgumentException if $pages is not array,
* \Zend\Config\Config or
* \Zend\Navigation\Container
*/
public function addPages($pages)
{
if ($pages instanceof Config\Config) {
$pages = $pages->toArray();
}

if ($pages instanceof Container) {
$pages = iterator_to_array($pages);
}

if (!is_array($pages)) {
throw new Exception\InvalidArgumentException(
'Invalid argument: $pages must be an array or an ' .
'instance of Zend_Config');
'Invalid argument: $pages must be an array, an '
. 'instance of \Zend\Config\Config or an instance of '
. '\Zend\Navigation\Container'
);
}

foreach ($pages as $page) {
Expand Down
4 changes: 2 additions & 2 deletions src/Exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
* @category Zend
* @package Zend_Navigation
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand All @@ -28,7 +28,7 @@
*
* @category Zend
* @package Zend_Navigation
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
interface Exception
Expand Down
4 changes: 2 additions & 2 deletions src/Navigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*
* @category Zend
* @package Zend_Navigation
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand All @@ -30,7 +30,7 @@
* @uses \Zend\Navigation\InvalidArgumentException
* @category Zend
* @package Zend_Navigation
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Navigation extends Container
Expand Down
4 changes: 2 additions & 2 deletions src/Page/Mvc.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* @category Zend
* @package Zend_Navigation
* @subpackage Page
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand All @@ -36,7 +36,7 @@
* @category Zend
* @package Zend_Navigation
* @subpackage Page
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Mvc extends AbstractPage
Expand Down
29 changes: 16 additions & 13 deletions src/Page/Uri.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* @category Zend
* @package Zend_Navigation
* @subpackage Page
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand All @@ -35,7 +35,7 @@
* @category Zend
* @package Zend_Navigation
* @subpackage Page
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Uri extends AbstractPage
Expand All @@ -45,23 +45,25 @@ class Uri extends AbstractPage
*
* @var string|null
*/
protected $_uri = null;
protected $uri = null;

/**
* Sets page URI
*
* @param string $uri page URI, must a string or null
*
* @return \Zend\Navigation\Page\Uri fluent interface, returns self
* @throws \Zend\Navigation\InvalidArgumentException if $uri is invalid
*/
public function setUri($uri)
{
if (null !== $uri && !is_string($uri)) {
throw new InvalidArgumentException(
'Invalid argument: $uri must be a string or null');
'Invalid argument: $uri must be a string or null'
);
}

$this->_uri = $uri;
$this->uri = $uri;
return $this;
}

Expand All @@ -72,29 +74,29 @@ public function setUri($uri)
*/
public function getUri()
{
return $this->_uri;
return $this->uri;
}

/**
* Returns href for this page
*
*
* Includes the fragment identifier if it is set.
*
* @return string
*/
public function getHref()
{
$uri = $this->getUri();
$fragment = $this->getFragment();

$fragment = $this->getFragment();
if (null !== $fragment) {
if ('#' == substr($uri, -1)) {
return $uri . $fragment;
} else {
} else {
return $uri . '#' . $fragment;
}
}

return $uri;
}

Expand All @@ -110,7 +112,8 @@ public function toArray()
return array_merge(
parent::toArray(),
array(
'uri' => $this->getUri()
));
'uri' => $this->getUri()
)
);
}
}
22 changes: 20 additions & 2 deletions test/ContainerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* @category Zend
* @package Zend_Navigation
* @subpackage UnitTests
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand All @@ -35,7 +35,7 @@
* @category Zend
* @package Zend_Navigation
* @subpackage UnitTests
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @group Zend_Navigation
*/
Expand Down Expand Up @@ -376,6 +376,24 @@ public function testAddPagesShouldWorkWithMixedArray()
'Expected 3 pages, found ' . count($nav));
}

/**
* @group ZF-9815
*/
public function testAddPagesShouldWorkWithNavigationContainer()
{
$nav = new Navigation\Navigation();
$nav->addPages($this->_getFindByNavigation());

$this->assertEquals(
3, count($nav), 'Expected 3 pages, found ' . count($nav)
);

$this->assertEquals(
$nav->toArray(),
$this->_getFindByNavigation()->toArray()
);
}

public function testAddPagesShouldThrowExceptionWhenGivenString()
{
$nav = new Navigation\Navigation();
Expand Down
4 changes: 2 additions & 2 deletions test/NavigationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* @category Zend
* @package Zend_Navigation
* @subpackage UnitTests
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand All @@ -33,7 +33,7 @@
* @category Zend
* @package Zend_Navigation
* @subpackage UnitTests
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @group Zend_Navigation
*/
Expand Down
4 changes: 2 additions & 2 deletions test/Page/MvcTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* @category Zend
* @package Zend_Navigation
* @subpackage UnitTests
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand All @@ -39,7 +39,7 @@
* @category Zend
* @package Zend_Navigation
* @subpackage UnitTests
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @group Zend_Navigation
*/
Expand Down
4 changes: 2 additions & 2 deletions test/Page/UriTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* @category Zend
* @package Zend_Navigation
* @subpackage UnitTests
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand All @@ -32,7 +32,7 @@
* @category Zend
* @package Zend_Navigation
* @subpackage UnitTests
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @group Zend_Navigation
*/
Expand Down
4 changes: 2 additions & 2 deletions test/PageFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* @category Zend
* @package Zend_Navigation
* @subpackage UnitTests
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand All @@ -34,7 +34,7 @@
* @category Zend
* @package Zend_Navigation
* @subpackage UnitTests
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @group Zend_Navigation
*/
Expand Down
4 changes: 2 additions & 2 deletions test/PageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* @category Zend
* @package Zend_Navigation
* @subpackage UnitTests
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand All @@ -36,7 +36,7 @@
* @category Zend
* @package Zend_Navigation
* @subpackage UnitTests
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @group Zend_Navigation
*/
Expand Down
4 changes: 2 additions & 2 deletions test/TestAsset/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* @category Zend
* @package Zend_Navigation
* @subpackage UnitTests
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand All @@ -28,7 +28,7 @@
* @category Zend
* @package Zend_Navigation
* @subpackage UnitTests
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Container extends \Zend\Navigation\Container
Expand Down
4 changes: 2 additions & 2 deletions test/TestAsset/InvalidPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* @category Zend
* @package Zend_Navigation
* @subpackage UnitTests
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

Expand All @@ -28,7 +28,7 @@
* @category Zend
* @package Zend_Navigation
* @subpackage UnitTests
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class InvalidPage
Expand Down
Loading

0 comments on commit b4124fc

Please sign in to comment.