3 /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
10 * Copyright © 2021-2023 The Galette Team
12 * This file is part of Galette (http://galette.tuxfamily.org).
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.
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.
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/>.
27 * @category DynamicFields
28 * @package GaletteTests
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
37 namespace Galette\DynamicFields\test\units
;
39 use PHPUnit\Framework\TestCase
;
44 * @category DynamicFields
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
53 class Date
extends TestCase
55 private \Galette\Core\Db
$zdb;
56 private \Galette\DynamicFields\Date
$date;
63 public function setUp(): void
65 $this->zdb
= new \Galette\Core\
Db();
66 $this->date
= new \Galette\DynamicFields\
Date($this->zdb
);
74 public function testConstructor()
76 $o = new \Galette\DynamicFields\
Date($this->zdb
, 10);
77 $this->assertNull($o->getId());
85 public function testGetTypeName()
87 $this->assertSame(_T('date'), $this->date
->getTypeName());
91 * Test if basic properties are ok
95 public function testBaseProperties()
97 $muliple = $this->date
->isMultiValued();
98 $this->assertFalse($muliple);
100 $required = $this->date
->isRequired();
101 $this->assertFalse($required);
103 $name = $this->date
->getName();
104 $this->assertSame('', $name);
106 $has_fixed_values = $this->date
->hasFixedValues();
107 $this->assertFalse($has_fixed_values);
109 $has_data = $this->date
->hasData();
110 $this->assertTrue($has_data);
112 $has_w = $this->date
->hasWidth();
113 $this->assertFalse($has_w);
115 $has_h = $this->date
->hasHeight();
116 $this->assertFalse($has_h);
118 $has_s = $this->date
->hasSize();
119 $this->assertFalse($has_s);
121 $perms = $this->date
->getPerm();
122 $this->assertNull($perms);
124 $width = $this->date
->getWidth();
125 $this->assertNull($width);
127 $height = $this->date
->getHeight();
128 $this->assertNull($height);
130 $repeat = $this->date
->getRepeat();
131 $this->assertNull($repeat);
133 $repeat = $this->date
->isRepeatable();
134 $this->assertFalse($repeat);
136 $size = $this->date
->getSize();
137 $this->assertNull($size);
139 $values = $this->date
->getValues();
140 $this->assertFalse($values);
142 $this->assertTrue($this->date
->hasPermissions());