]> git.agnieray.net Git - galette.git/blob - tests/Galette/DynamicFields/tests/units/Separator.php
4d5470901bf50637d79eb5a9daba00804935b789
[galette.git] / tests / Galette / DynamicFields / tests / units / Separator.php
1 <?php
2
3 /**
4 * Copyright © 2003-2024 The Galette Team
5 *
6 * This file is part of Galette (https://galette.eu).
7 *
8 * Galette is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * Galette is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with Galette. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22 namespace Galette\DynamicFields\test\units;
23
24 use PHPUnit\Framework\TestCase;
25
26 /**
27 * Dynamic separator test
28 *
29 * @author Johan Cwiklinski <johan@x-tnd.be>
30 */
31 class Separator extends TestCase
32 {
33 private \Galette\Core\Db $zdb;
34 private \Galette\DynamicFields\Separator $separator;
35
36 /**
37 * Set up tests
38 *
39 * @return void
40 */
41 public function setUp(): void
42 {
43 $this->zdb = new \Galette\Core\Db();
44 $this->separator = new \Galette\DynamicFields\Separator($this->zdb);
45 }
46
47 /**
48 * Test constructor
49 *
50 * @return void
51 */
52 public function testConstructor()
53 {
54 $o = new \Galette\DynamicFields\Separator($this->zdb, 10);
55 $this->assertNull($o->getId());
56 }
57
58 /**
59 * Test get type name
60 *
61 * @return void
62 */
63 public function testGetTypeName()
64 {
65 $this->assertSame(_T('separator'), $this->separator->getTypeName());
66 }
67
68 /**
69 * Test if basic properties are ok
70 *
71 * @return void
72 */
73 public function testBaseProperties()
74 {
75 $muliple = $this->separator->isMultiValued();
76 $this->assertFalse($muliple);
77
78 $required = $this->separator->isRequired();
79 $this->assertFalse($required);
80
81 $name = $this->separator->getName();
82 $this->assertSame('', $name);
83
84 $has_fixed_values = $this->separator->hasFixedValues();
85 $this->assertFalse($has_fixed_values);
86
87 $has_data = $this->separator->hasData();
88 $this->assertFalse($has_data);
89
90 $has_w = $this->separator->hasWidth();
91 $this->assertFalse($has_w);
92
93 $has_h = $this->separator->hasHeight();
94 $this->assertFalse($has_h);
95
96 $has_s = $this->separator->hasSize();
97 $this->assertFalse($has_s);
98
99 $perms = $this->separator->getPermission();
100 $this->assertNull($perms);
101
102 $width = $this->separator->getWidth();
103 $this->assertNull($width);
104
105 $height = $this->separator->getHeight();
106 $this->assertNull($height);
107
108 $repeat = $this->separator->getRepeat();
109 $this->assertNull($repeat);
110
111 $repeat = $this->separator->isRepeatable();
112 $this->assertFalse($repeat);
113
114 $size = $this->separator->getSize();
115 $this->assertNull($size);
116
117 $values = $this->separator->getValues();
118 $this->assertFalse($values);
119
120 $this->assertFalse($this->separator->hasPermissions());
121 }
122 }