4 * Copyright © 2003-2024 The Galette Team
6 * This file is part of Galette (https://galette.eu).
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.
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.
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/>.
22 namespace Galette\DynamicFields\test\units
;
24 use PHPUnit\Framework\TestCase
;
27 * Dynamic separator test
29 * @author Johan Cwiklinski <johan@x-tnd.be>
31 class Separator
extends TestCase
33 private \Galette\Core\Db
$zdb;
34 private \Galette\DynamicFields\Separator
$separator;
41 public function setUp(): void
43 $this->zdb
= new \Galette\Core\
Db();
44 $this->separator
= new \Galette\DynamicFields\
Separator($this->zdb
);
52 public function testConstructor()
54 $o = new \Galette\DynamicFields\
Separator($this->zdb
, 10);
55 $this->assertNull($o->getId());
63 public function testGetTypeName()
65 $this->assertSame(_T('separator'), $this->separator
->getTypeName());
69 * Test if basic properties are ok
73 public function testBaseProperties()
75 $muliple = $this->separator
->isMultiValued();
76 $this->assertFalse($muliple);
78 $required = $this->separator
->isRequired();
79 $this->assertFalse($required);
81 $name = $this->separator
->getName();
82 $this->assertSame('', $name);
84 $has_fixed_values = $this->separator
->hasFixedValues();
85 $this->assertFalse($has_fixed_values);
87 $has_data = $this->separator
->hasData();
88 $this->assertFalse($has_data);
90 $has_w = $this->separator
->hasWidth();
91 $this->assertFalse($has_w);
93 $has_h = $this->separator
->hasHeight();
94 $this->assertFalse($has_h);
96 $has_s = $this->separator
->hasSize();
97 $this->assertFalse($has_s);
99 $perms = $this->separator
->getPermission();
100 $this->assertNull($perms);
102 $width = $this->separator
->getWidth();
103 $this->assertNull($width);
105 $height = $this->separator
->getHeight();
106 $this->assertNull($height);
108 $repeat = $this->separator
->getRepeat();
109 $this->assertNull($repeat);
111 $repeat = $this->separator
->isRepeatable();
112 $this->assertFalse($repeat);
114 $size = $this->separator
->getSize();
115 $this->assertNull($size);
117 $values = $this->separator
->getValues();
118 $this->assertFalse($values);
120 $this->assertFalse($this->separator
->hasPermissions());