Adding enclosures now treats type and length parameters as optional for Atom, but...
[zend.git] / tests / Zend / NavigationTest.php
blobc7b931dce015de84f9d194c4b1bf9f01227e7959
1 <?php
2 /**
3 * Zend Framework
5 * LICENSE
7 * This source file is subject to the new BSD license that is bundled
8 * with this package in the file LICENSE.txt.
9 * It is also available through the world-wide-web at this URL:
10 * http://framework.zend.com/license/new-bsd
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@zend.com so we can send you a copy immediately.
15 * @category Zend
16 * @package Zend_Navigation
17 * @subpackage UnitTests
18 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19 * @license http://framework.zend.com/license/new-bsd New BSD License
20 * @version $Id:$
23 if (!defined('PHPUnit_MAIN_METHOD')) {
24 define('PHPUnit_MAIN_METHOD', 'Zend_NavigationTest::main');
27 require_once dirname(__FILE__) . '/../TestHelper.php';
29 /**
30 * Zend_Navigation
32 require_once 'Zend/Navigation.php';
34 /**
35 * @category Zend
36 * @package Zend_Navigation
37 * @subpackage UnitTests
38 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
39 * @license http://framework.zend.com/license/new-bsd New BSD License
40 * @group Zend_Navigation
42 class Zend_NavigationTest extends PHPUnit_Framework_TestCase
44 /**
45 * @var Zend_Navigation
47 private $_navigation;
49 protected function setUp()
51 parent::setUp();
52 $this->_navigation = new Zend_Navigation();
55 protected function tearDown()
57 $this->_navigation = null;
58 parent::tearDown();
60 /**
61 * Runs the test methods of this class.
63 * @return void
65 public static function main()
67 $suite = new PHPUnit_Framework_TestSuite("Zend_NavigationTest");
68 $result = PHPUnit_TextUI_TestRunner::run($suite);
71 /**
72 * Testing that navigation order is done correctly
74 * @group ZF-8337
75 * @group ZF-8313
77 public function testNavigationArraySortsCorrectly()
79 require_once 'Zend/Navigation/Page/Uri.php';
80 $page1 = new Zend_Navigation_Page_Uri(array('uri' => 'page1'));
81 $page2 = new Zend_Navigation_Page_Uri(array('uri' => 'page2'));
82 $page3 = new Zend_Navigation_Page_Uri(array('uri' => 'page3'));
84 $this->_navigation->setPages(array($page1, $page2, $page3));
86 $page1->setOrder(1);
87 $page3->setOrder(0);
88 $page2->setOrder(2);
90 $pages = $this->_navigation->toArray();
91 $this->assertSame(3, count($pages));
92 $this->assertEquals('page3', $pages[0]['uri']);
93 $this->assertEquals('page1', $pages[1]['uri']);
94 $this->assertEquals('page2', $pages[2]['uri']);