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