‪TYPO3CMS  10.4
SplitButtonTest.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
21 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
22 
26 class ‪SplitButtonTest extends UnitTestCase
27 {
34  {
35  $button = new ‪SplitButton();
36  $isValid = $button->isValid();
37  self::assertFalse($isValid);
38  }
39 
46  {
47  $this->expectException(\InvalidArgumentException::class);
48  $this->expectExceptionCode(1441706330);
49  $button = new ‪SplitButton();
50 
51  $primaryAction = new ‪LinkButton();
52  $button->addItem($primaryAction);
53 
54  $isValid = $button->isValid();
55  self::assertFalse($isValid);
56  }
57 
64  {
65  $this->expectException(\InvalidArgumentException::class);
66  $this->expectExceptionCode(1441706340);
67  $button = new ‪SplitButton();
68 
69  $primaryAction = new ‪LinkButton();
70  $icon = new ‪Icon();
71  $primaryAction->setTitle('husel')->setHref('husel')->setIcon($icon);
72  $button->addItem($primaryAction, true);
73 
74  $anotherPrimaryAction = new ‪LinkButton();
75  $anotherPrimaryAction->setTitle('husel')->setHref('husel')->setIcon($icon);
76  $button->addItem($anotherPrimaryAction, true);
77 
78  $isValid = $button->isValid();
79  self::assertFalse($isValid);
80  }
81 
88  {
89  $this->expectException(\InvalidArgumentException::class);
90  $this->expectExceptionCode(1441706330);
91  $button = new ‪SplitButton();
92 
93  $primaryAction = new ‪LinkButton();
94  $icon = new ‪Icon();
95  $primaryAction->setTitle('husel')->setHref('husel')->setIcon($icon);
96  $button->addItem($primaryAction, true);
97 
98  $anotherPrimaryAction = new ‪LinkButton();
99  $anotherPrimaryAction->setTitle('husel')->setHref('husel');
100  $button->addItem($anotherPrimaryAction, true);
101 
102  $isValid = $button->isValid();
103  self::assertFalse($isValid);
104  }
105 
112  {
113  $button = new ‪SplitButton();
114 
115  $primaryAction = new ‪LinkButton();
116  $icon = new ‪Icon();
117  $primaryAction->setTitle('husel')->setHref('husel')->setIcon($icon);
118  $button->addItem($primaryAction, true);
119 
120  $anotherAction = new ‪LinkButton();
121  $anotherAction->setTitle('husel')->setHref('husel')->setIcon($icon);
122  $button->addItem($anotherAction);
123 
124  $isValid = $button->isValid();
125  self::assertTrue($isValid);
126  }
127 }
‪TYPO3\CMS\Core\Imaging\Icon
Definition: Icon.php:26
‪TYPO3\CMS\Backend\Tests\Unit\Template\Components\Button\SplitButtonTest\isButtonValidBrokenSetupMultiplePrimaryActionsGivenExpectFalse
‪isButtonValidBrokenSetupMultiplePrimaryActionsGivenExpectFalse()
Definition: SplitButtonTest.php:63
‪TYPO3\CMS\Backend\Tests\Unit\Template\Components\Button\SplitButtonTest\isButtonValidBlankCallExpectFalse
‪isButtonValidBlankCallExpectFalse()
Definition: SplitButtonTest.php:33
‪TYPO3\CMS\Backend\Tests\Unit\Template\Components\Button\SplitButtonTest\isButtonValidBrokenSetupInvalidButtonAsSecondParametersGivenExpectFalse
‪isButtonValidBrokenSetupInvalidButtonAsSecondParametersGivenExpectFalse()
Definition: SplitButtonTest.php:87
‪TYPO3\CMS\Backend\Tests\Unit\Template\Components\Button
Definition: FullyRenderedButtonTest.php:16
‪TYPO3\CMS\Backend\Template\Components\Buttons\SplitButton
Definition: SplitButton.php:52
‪TYPO3\CMS\Backend\Tests\Unit\Template\Components\Button\SplitButtonTest\isButtonValidValidSetupExpectTrue
‪isButtonValidValidSetupExpectTrue()
Definition: SplitButtonTest.php:111
‪TYPO3\CMS\Backend\Tests\Unit\Template\Components\Button\SplitButtonTest
Definition: SplitButtonTest.php:27
‪TYPO3\CMS\Backend\Tests\Unit\Template\Components\Button\SplitButtonTest\isButtonValidInvalidButtonGivenExpectFalse
‪isButtonValidInvalidButtonGivenExpectFalse()
Definition: SplitButtonTest.php:45