Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
3,049 additions
and
4 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
<?php | ||
|
||
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ | ||
|
||
/** | ||
* Dynamic booleans tests | ||
* | ||
* PHP version 5 | ||
* | ||
* Copyright © 2013-2023 The Galette Team | ||
* | ||
* This file is part of Galette (http://galette.tuxfamily.org). | ||
* | ||
* Galette is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Galette is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with Galette. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
* @category DynamicFields | ||
* @package GaletteTests | ||
* | ||
* @author Johan Cwiklinski <johan@x-tnd.be> | ||
* @copyright 2013-2023 The Galette Team | ||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version | ||
* @version SVN: $Id$ | ||
* @link http://galette.tuxfamily.org | ||
* @since 2013-10-18 | ||
*/ | ||
|
||
namespace Galette\DynamicFields\test\units; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* Dynamic booleans test | ||
* | ||
* @category DynamicFields | ||
* @name Boolean | ||
* @package GaletteTests | ||
* @author Johan Cwiklinski <johan@x-tnd.be> | ||
* @copyright 2013-2023 The Galette Team | ||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version | ||
* @link http://galette.tuxfamily.org | ||
* @since 2013-10-18 | ||
*/ | ||
class Boolean extends TestCase | ||
{ | ||
private \Galette\Core\Db $zdb; | ||
private \Galette\DynamicFields\Boolean $bool; | ||
|
||
/** | ||
* Set up tests | ||
* | ||
* @return void | ||
*/ | ||
public function setUp(): void | ||
{ | ||
$this->zdb = new \Galette\Core\Db(); | ||
$this->bool = new \Galette\DynamicFields\Boolean($this->zdb); | ||
} | ||
|
||
/** | ||
* Test constructor | ||
* | ||
* @return void | ||
*/ | ||
public function testConstructor() | ||
{ | ||
$o = new \Galette\DynamicFields\Boolean($this->zdb, 10); | ||
$this->assertNull($o->getId()); | ||
} | ||
|
||
/** | ||
* Test get type name | ||
* | ||
* @return void | ||
*/ | ||
public function testGetTypeName() | ||
{ | ||
$this->assertSame(_T('boolean'), $this->bool->getTypeName()); | ||
} | ||
|
||
/** | ||
* Test if basic properties are ok | ||
* | ||
* @return void | ||
*/ | ||
public function testBaseProperties() | ||
{ | ||
$muliple = $this->bool->isMultiValued(); | ||
$this->assertFalse($muliple); | ||
|
||
$required = $this->bool->isRequired(); | ||
$this->assertFalse($required); | ||
|
||
$name = $this->bool->getName(); | ||
$this->assertSame('', $name); | ||
|
||
$has_fixed_values = $this->bool->hasFixedValues(); | ||
$this->assertFalse($has_fixed_values); | ||
|
||
$has_data = $this->bool->hasData(); | ||
$this->assertTrue($has_data); | ||
|
||
$has_w = $this->bool->hasWidth(); | ||
$this->assertFalse($has_w); | ||
|
||
$has_h = $this->bool->hasHeight(); | ||
$this->assertFalse($has_h); | ||
|
||
$has_s = $this->bool->hasSize(); | ||
$this->assertFalse($has_s); | ||
|
||
$perms = $this->bool->getPerm(); | ||
$this->assertNull($perms); | ||
|
||
$width = $this->bool->getWidth(); | ||
$this->assertNull($width); | ||
|
||
$height = $this->bool->getHeight(); | ||
$this->assertNull($height); | ||
|
||
$repeat = $this->bool->getRepeat(); | ||
$this->assertNull($repeat); | ||
|
||
$repeat = $this->bool->isRepeatable(); | ||
$this->assertFalse($repeat); | ||
|
||
$size = $this->bool->getSize(); | ||
$this->assertNull($size); | ||
|
||
$values = $this->bool->getValues(); | ||
$this->assertFalse($values); | ||
|
||
$this->assertTrue($this->bool->hasPermissions()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
<?php | ||
|
||
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ | ||
|
||
/** | ||
* Dynamic choice tests | ||
* | ||
* PHP version 5 | ||
* | ||
* Copyright © 2021-2023 The Galette Team | ||
* | ||
* This file is part of Galette (http://galette.tuxfamily.org). | ||
* | ||
* Galette is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Galette is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with Galette. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
* @category DynamicFields | ||
* @package GaletteTests | ||
* | ||
* @author Johan Cwiklinski <johan@x-tnd.be> | ||
* @copyright 2021-2023 The Galette Team | ||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version | ||
* @version SVN: $Id$ | ||
* @link http://galette.tuxfamily.org | ||
* @since 2021-11-11 | ||
*/ | ||
|
||
namespace Galette\DynamicFields\test\units; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* Dynamic choice test | ||
* | ||
* @category DynamicFields | ||
* @name Choice | ||
* @package GaletteTests | ||
* @author Johan Cwiklinski <johan@x-tnd.be> | ||
* @copyright 2021-2023 The Galette Team | ||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version | ||
* @link http://galette.tuxfamily.org | ||
* @since 2021-11-11 | ||
*/ | ||
class Choice extends TestCase | ||
{ | ||
private \Galette\Core\Db $zdb; | ||
private \Galette\DynamicFields\Choice $choice; | ||
|
||
/** | ||
* Set up tests | ||
* | ||
* @return void | ||
*/ | ||
public function setUp(): void | ||
{ | ||
$this->zdb = new \Galette\Core\Db(); | ||
$this->choice = new \Galette\DynamicFields\Choice($this->zdb); | ||
} | ||
|
||
/** | ||
* Test constructor | ||
* | ||
* @return void | ||
*/ | ||
public function testConstructor() | ||
{ | ||
$o = new \Galette\DynamicFields\Choice($this->zdb, 10); | ||
$this->assertNull($o->getId()); | ||
} | ||
|
||
/** | ||
* Test get type name | ||
* | ||
* @return void | ||
*/ | ||
public function testGetTypeName() | ||
{ | ||
$this->assertSame(_T('choice'), $this->choice->getTypeName()); | ||
} | ||
|
||
/** | ||
* Test if basic properties are ok | ||
* | ||
* @return void | ||
*/ | ||
public function testBaseProperties() | ||
{ | ||
$muliple = $this->choice->isMultiValued(); | ||
$this->assertFalse($muliple); | ||
|
||
$required = $this->choice->isRequired(); | ||
$this->assertFalse($required); | ||
|
||
$name = $this->choice->getName(); | ||
$this->assertSame('', $name); | ||
|
||
$has_fixed_values = $this->choice->hasFixedValues(); | ||
$this->assertTrue($has_fixed_values); | ||
|
||
$has_data = $this->choice->hasData(); | ||
$this->assertTrue($has_data); | ||
|
||
$has_w = $this->choice->hasWidth(); | ||
$this->assertFalse($has_w); | ||
|
||
$has_h = $this->choice->hasHeight(); | ||
$this->assertFalse($has_h); | ||
|
||
$has_s = $this->choice->hasSize(); | ||
$this->assertFalse($has_s); | ||
|
||
$perms = $this->choice->getPerm(); | ||
$this->assertNull($perms); | ||
|
||
$width = $this->choice->getWidth(); | ||
$this->assertNull($width); | ||
|
||
$height = $this->choice->getHeight(); | ||
$this->assertNull($height); | ||
|
||
$repeat = $this->choice->getRepeat(); | ||
$this->assertNull($repeat); | ||
|
||
$repeat = $this->choice->isRepeatable(); | ||
$this->assertFalse($repeat); | ||
|
||
$size = $this->choice->getSize(); | ||
$this->assertNull($size); | ||
|
||
$values = $this->choice->getValues(); | ||
$this->assertFalse($values); | ||
|
||
$this->assertTrue($this->choice->hasPermissions()); | ||
} | ||
} |
Oops, something went wrong.