TYPO3  7.6
SplitButtonTest.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Backend\Tests\Template\Components\Buttons;
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 
20 use TYPO3\CMS\Core\Tests\UnitTestCase;
21 
25 class SplitButtonTest extends UnitTestCase
26 {
34  {
35  $button = new SplitButton();
36  $isValid = $button->isValid();
37  $this->assertFalse($isValid);
38  }
39 
49  {
50  $button = new SplitButton();
51 
52  $primaryAction = new LinkButton();
53  $button->addItem($primaryAction);
54 
55  $isValid = $button->isValid();
56  $this->assertFalse($isValid);
57  }
58 
68  {
69  $button = new SplitButton();
70 
71  $primaryAction = new LinkButton();
72  $icon = new Icon();
73  $primaryAction->setTitle('husel')->setHref('husel')->setIcon($icon);
74  $button->addItem($primaryAction, true);
75 
76  $anotherPrimaryAction = new LinkButton();
77  $anotherPrimaryAction->setTitle('husel')->setHref('husel')->setIcon($icon);
78  $button->addItem($anotherPrimaryAction, true);
79 
80  $isValid = $button->isValid();
81  $this->assertFalse($isValid);
82  }
83 
93  {
94  $button = new SplitButton();
95 
96  $primaryAction = new LinkButton();
97  $icon = new Icon();
98  $primaryAction->setTitle('husel')->setHref('husel')->setIcon($icon);
99  $button->addItem($primaryAction, true);
100 
101  $anotherPrimaryAction = new LinkButton();
102  $anotherPrimaryAction->setTitle('husel')->setHref('husel');
103  $button->addItem($anotherPrimaryAction, true);
104 
105  $isValid = $button->isValid();
106  $this->assertFalse($isValid);
107  }
108 
116  {
117  $button = new SplitButton();
118 
119  $primaryAction = new LinkButton();
120  $icon = new Icon();
121  $primaryAction->setTitle('husel')->setHref('husel')->setIcon($icon);
122  $button->addItem($primaryAction, true);
123 
124  $anotherAction = new LinkButton();
125  $anotherAction->setTitle('husel')->setHref('husel')->setIcon($icon);
126  $button->addItem($anotherAction);
127 
128  $isValid = $button->isValid();
129  $this->assertTrue($isValid);
130  }
131 }