Adjust the test for Icinga\Web\MenuItem as its test subject has changed
refs #6153
This commit is contained in:
parent
be18af7e7e
commit
8eac449d56
|
@ -1,29 +0,0 @@
|
||||||
<?php
|
|
||||||
// {{{ICINGA_LICENSE_HEADER}}}
|
|
||||||
// {{{ICINGA_LICENSE_HEADER}}}
|
|
||||||
|
|
||||||
namespace Tests\Icinga\Web;
|
|
||||||
|
|
||||||
use Zend_Config;
|
|
||||||
use Icinga\Web\MenuItem;
|
|
||||||
use Icinga\Test\BaseTestCase;
|
|
||||||
|
|
||||||
class MenuItemTest extends BaseTestCase
|
|
||||||
{
|
|
||||||
public function testWhetherMenuItemsAreNaturallySorted()
|
|
||||||
{
|
|
||||||
$item = new MenuItem('test');
|
|
||||||
$item->addChild(5, new Zend_Config(array('title' => 'ccc5')));
|
|
||||||
$item->addChild(0, new Zend_Config(array('title' => 'aaa')));
|
|
||||||
$item->addChild(3, new Zend_Config(array('title' => 'ccc')));
|
|
||||||
$item->addChild(2, new Zend_Config(array('title' => 'bbb')));
|
|
||||||
$item->addChild(4, new Zend_Config(array('title' => 'ccc2')));
|
|
||||||
$item->addChild(1, new Zend_Config(array('title' => 'bb')));
|
|
||||||
|
|
||||||
$this->assertEquals(
|
|
||||||
array('aaa', 'bb', 'bbb', 'ccc', 'ccc2', 'ccc5'),
|
|
||||||
array_map(function ($it) { return $it->getTitle(); }, $item->getChildren()),
|
|
||||||
'MenuItem::getChildren does not return its elements in natural order'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
<?php
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
// {{{ICINGA_LICENSE_HEADER}}}
|
||||||
|
|
||||||
|
namespace Tests\Icinga\Web;
|
||||||
|
|
||||||
|
use Zend_Config;
|
||||||
|
use Icinga\Web\Menu;
|
||||||
|
use Icinga\Test\BaseTestCase;
|
||||||
|
|
||||||
|
class MenuTest extends BaseTestCase
|
||||||
|
{
|
||||||
|
public function testWhetherMenusAreNaturallySorted()
|
||||||
|
{
|
||||||
|
$menu = new Menu('test');
|
||||||
|
$menu->addSubMenu(5, new Zend_Config(array('title' => 'ccc5')));
|
||||||
|
$menu->addSubMenu(0, new Zend_Config(array('title' => 'aaa')));
|
||||||
|
$menu->addSubMenu(3, new Zend_Config(array('title' => 'ccc')));
|
||||||
|
$menu->addSubMenu(2, new Zend_Config(array('title' => 'bbb')));
|
||||||
|
$menu->addSubMenu(4, new Zend_Config(array('title' => 'ccc2')));
|
||||||
|
$menu->addSubMenu(1, new Zend_Config(array('title' => 'bb')));
|
||||||
|
|
||||||
|
$this->assertEquals(
|
||||||
|
array('aaa', 'bb', 'bbb', 'ccc', 'ccc2', 'ccc5'),
|
||||||
|
array_map(function ($m) { return $m->getTitle(); }, iterator_to_array($menu->order())),
|
||||||
|
'Menu::order() does not return its elements in natural order'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue