[BUGFIX] Add missing namespace parts
[Packages/TYPO3.CMS.git] / typo3 / sysext / backend / Tests / Unit / Template / Components / Button / InputButtonTest.php
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
17 use TYPO3\CMS\Backend\Template\Components\Buttons\InputButton;
18 use TYPO3\CMS\Core\Imaging\Icon;
19
20 /**
21 * Test case for InputButton
22 */
23 class InputButtonTest extends \TYPO3\Components\TestingFramework\Core\Unit\UnitTestCase
24 {
25 /**
26 * Try to validate an empty button
27 *
28 * @test
29 * @return void
30 */
31 public function isButtonValidBlankCallExpectFalse()
32 {
33 $button = new InputButton();
34 $isValid = $button->isValid();
35 $this->assertFalse($isValid);
36 }
37
38 /**
39 * Omit the Icon
40 *
41 * @test
42 * @return void
43 */
44 public function isButtonValidOmittedIconExpectFalse()
45 {
46 $button = new InputButton();
47 $button->setName('husel')->setValue('1')->setTitle('huhu');
48 $isValid = $button->isValid();
49 $this->assertFalse($isValid);
50 }
51
52 /**
53 * Omit the title
54 *
55 * @test
56 * @return void
57 */
58 public function isButtonValidOmittedTitleExpectFalse()
59 {
60 $button = new InputButton();
61 $icon = new Icon();
62 $button->setName('husel')->setValue('1')->setIcon($icon);
63 $isValid = $button->isValid();
64 $this->assertFalse($isValid);
65 }
66
67 /**
68 * Omit the name
69 *
70 * @test
71 * @return void
72 */
73 public function isButtonValidOmittedNameExpectFalse()
74 {
75 $button = new InputButton();
76 $icon = new Icon();
77 $button->setTitle('husel')->setValue('1')->setIcon($icon);
78 $isValid = $button->isValid();
79 $this->assertFalse($isValid);
80 }
81
82 /**
83 * Omit the Value
84 *
85 * @test
86 * @return void
87 */
88 public function isButtonValidOmittedValueExpectFalse()
89 {
90 $button = new InputButton();
91 $icon = new Icon();
92 $button->setTitle('husel')->setName('husel')->setIcon($icon);
93 $isValid = $button->isValid();
94 $this->assertFalse($isValid);
95 }
96
97 /**
98 * Set a 100% valid button
99 *
100 * @test
101 * @return void
102 */
103 public function isButtonValidAllValuesSetExpectTrue()
104 {
105 $button = new InputButton();
106 $icon = new Icon();
107 $button->setTitle('husel')->setName('husel')->setIcon($icon)->setValue('1');
108 $isValid = $button->isValid();
109 $this->assertTrue($isValid);
110 }
111 }