‪TYPO3CMS  9.5
SplitButtonTest.php
Go to the documentation of this file.
1 <?php
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\TestingFramework\Core\Unit\UnitTestCase;
21 
25 class ‪SplitButtonTest extends UnitTestCase
26 {
33  {
34  $button = new ‪SplitButton();
35  $isValid = $button->isValid();
36  $this->assertFalse($isValid);
37  }
38 
45  {
46  $this->expectException(\InvalidArgumentException::class);
47  $this->expectExceptionCode(1441706330);
48  $button = new ‪SplitButton();
49 
50  $primaryAction = new ‪LinkButton();
51  $button->addItem($primaryAction);
52 
53  $isValid = $button->isValid();
54  $this->assertFalse($isValid);
55  }
56 
63  {
64  $this->expectException(\InvalidArgumentException::class);
65  $this->expectExceptionCode(1441706340);
66  $button = new ‪SplitButton();
67 
68  $primaryAction = new ‪LinkButton();
69  $icon = new ‪Icon();
70  $primaryAction->setTitle('husel')->setHref('husel')->setIcon($icon);
71  $button->addItem($primaryAction, true);
72 
73  $anotherPrimaryAction = new ‪LinkButton();
74  $anotherPrimaryAction->setTitle('husel')->setHref('husel')->setIcon($icon);
75  $button->addItem($anotherPrimaryAction, true);
76 
77  $isValid = $button->isValid();
78  $this->assertFalse($isValid);
79  }
80 
87  {
88  $this->expectException(\InvalidArgumentException::class);
89  $this->expectExceptionCode(1441706330);
90  $button = new ‪SplitButton();
91 
92  $primaryAction = new ‪LinkButton();
93  $icon = new ‪Icon();
94  $primaryAction->setTitle('husel')->setHref('husel')->setIcon($icon);
95  $button->addItem($primaryAction, true);
96 
97  $anotherPrimaryAction = new ‪LinkButton();
98  $anotherPrimaryAction->setTitle('husel')->setHref('husel');
99  $button->addItem($anotherPrimaryAction, true);
100 
101  $isValid = $button->isValid();
102  $this->assertFalse($isValid);
103  }
104 
111  {
112  $button = new ‪SplitButton();
113 
114  $primaryAction = new ‪LinkButton();
115  $icon = new ‪Icon();
116  $primaryAction->setTitle('husel')->setHref('husel')->setIcon($icon);
117  $button->addItem($primaryAction, true);
118 
119  $anotherAction = new ‪LinkButton();
120  $anotherAction->setTitle('husel')->setHref('husel')->setIcon($icon);
121  $button->addItem($anotherAction);
122 
123  $isValid = $button->isValid();
124  $this->assertTrue($isValid);
125  }
126 }
‪TYPO3\CMS\Core\Imaging\Icon
Definition: Icon.php:25
‪TYPO3\CMS\Backend\Tests\Unit\Template\Components\Button\SplitButtonTest\isButtonValidBrokenSetupMultiplePrimaryActionsGivenExpectFalse
‪isButtonValidBrokenSetupMultiplePrimaryActionsGivenExpectFalse()
Definition: SplitButtonTest.php:62
‪TYPO3\CMS\Backend\Tests\Unit\Template\Components\Button\SplitButtonTest\isButtonValidBlankCallExpectFalse
‪isButtonValidBlankCallExpectFalse()
Definition: SplitButtonTest.php:32
‪TYPO3\CMS\Backend\Tests\Unit\Template\Components\Button\SplitButtonTest\isButtonValidBrokenSetupInvalidButtonAsSecondParametersGivenExpectFalse
‪isButtonValidBrokenSetupInvalidButtonAsSecondParametersGivenExpectFalse()
Definition: SplitButtonTest.php:86
‪TYPO3\CMS\Backend\Tests\Unit\Template\Components\Button
Definition: FullyRenderedButtonTest.php:2
‪TYPO3\CMS\Backend\Template\Components\Buttons\SplitButton
Definition: SplitButton.php:51
‪TYPO3\CMS\Backend\Tests\Unit\Template\Components\Button\SplitButtonTest\isButtonValidValidSetupExpectTrue
‪isButtonValidValidSetupExpectTrue()
Definition: SplitButtonTest.php:110
‪TYPO3\CMS\Backend\Tests\Unit\Template\Components\Button\SplitButtonTest
Definition: SplitButtonTest.php:26
‪TYPO3\CMS\Backend\Tests\Unit\Template\Components\Button\SplitButtonTest\isButtonValidInvalidButtonGivenExpectFalse
‪isButtonValidInvalidButtonGivenExpectFalse()
Definition: SplitButtonTest.php:44