2ffd357b13c7bc9e4e4f46b0b9ed9829df84b0a6
[Packages/TYPO3.CMS.git] / typo3 / sysext / backend / Tests / Unit / Template / Components / Menu / MenuItemTest.php
1 <?php
2 namespace TYPO3\CMS\Backend\Tests\Template\Components\Menu;
3
4 /*
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 use TYPO3\CMS\Backend\Template\Components\Menu\MenuItem;
18
19 /**
20 * Test case for MenuItem
21 */
22 class MenuItemTest extends \TYPO3\Components\TestingFramework\Core\UnitTestCase
23 {
24 /**
25 * Try a blank menu Item
26 *
27 * @test
28 * @return void
29 */
30 public function isMenuItemValidBlankCallExpectFalse()
31 {
32 $menuItem = new MenuItem();
33 $isValid = $menuItem->isValid($menuItem);
34 $this->assertFalse($isValid);
35 }
36
37 /**
38 * Try omitting the title and a Href
39 *
40 * @test
41 * @return void
42 */
43 public function isMenuItemValidOmittedHrefAndRouteExpectFalse()
44 {
45 $menuItem = new MenuItem();
46 $menuItem->setTitle('huhu');
47 $isValid = $menuItem->isValid($menuItem);
48 $this->assertFalse($isValid);
49 }
50
51 /**
52 * Try omitting the title
53 *
54 * @test
55 * @return void
56 */
57 public function isMenuItemValidOmittedTitleExpectFalse()
58 {
59 $menuItem = new MenuItem();
60 $menuItem->setHref('husel');
61 $isValid = $menuItem->isValid($menuItem);
62 $this->assertFalse($isValid);
63 }
64
65 /**
66 * Set a valid title and href
67 *
68 * @test
69 * @return void
70 */
71 public function isMenuItemValidSetValidHrefAndTitleExpectTrue()
72 {
73 $menuItem = new MenuItem();
74 $menuItem->setTitle('husel')->setHref('husel');
75 $isValid = $menuItem->isValid($menuItem);
76 $this->assertTrue($isValid);
77 }
78 }