Files
kimai2/tests/Event/ConfigureMainMenuEventTest.php
Kevin Papst 25469113fd Release 2.0.2 (#3856)
* allow to overwrite global spreadsheet styles
* bump version
* fix deprecations in vcard download
* bump composer packages
* added help page for all registered locales
* fix menu id's, cleanup times route, fix configurable homepage redirect
* format duration without leading zero in hours (unify javascript with php behavior)
* fix active records in all screen sizes
* improved responsiveness in XS
* fixed invoice number for customer null fields
* fix javascript respects multiple recent-activity dropdowns
* show recent activities on small screens
* fix user-profile layout column in XS
* fix search is always marked as active
2023-02-21 19:21:49 +01:00

60 lines
2.0 KiB
PHP

<?php
/*
* This file is part of the Kimai time-tracking app.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Tests\Event;
use App\Event\ConfigureMainMenuEvent;
use App\Utils\MenuItemModel;
use PHPUnit\Framework\TestCase;
/**
* @covers \App\Event\ConfigureMainMenuEvent
*/
class ConfigureMainMenuEventTest extends TestCase
{
public function testGetterAndSetter()
{
$sut = new ConfigureMainMenuEvent();
self::assertNotNull($sut->getMenu());
self::assertNotNull($sut->getAdminMenu());
self::assertNotNull($sut->getAppsMenu());
self::assertNotNull($sut->getSystemMenu());
self::assertNull($sut->getTimesheetMenu());
self::assertNull($sut->getInvoiceMenu());
self::assertNull($sut->getReportingMenu());
$timesheet = new MenuItemModel('times', 'timesheet');
$sut->getMenu()->addChild($timesheet);
self::assertNotNull($sut->getTimesheetMenu());
self::assertSame($timesheet, $sut->getTimesheetMenu());
$invoice = new MenuItemModel('invoice', 'invoice');
$sut->getMenu()->addChild($invoice);
self::assertNotNull($sut->getInvoiceMenu());
self::assertSame($invoice, $sut->getInvoiceMenu());
self::assertNull($sut->findById('reporting'));
self::assertNull($sut->findById('foo'));
self::assertNull($sut->findById('bar'));
$reporting = new MenuItemModel('reporting', 'reporting');
$sut->getMenu()->addChild($reporting);
$reporting->addChild(new MenuItemModel('foo', 'foo'));
$reporting->addChild(new MenuItemModel('bar', 'bar'));
self::assertNotNull($sut->getReportingMenu());
self::assertSame($reporting, $sut->getReportingMenu());
self::assertSame($reporting, $sut->findById('reporting'));
self::assertNotNull($sut->findById('foo'));
self::assertNotNull($sut->findById('bar'));
}
}