loop arguments
product loop
This commit is contained in:
@@ -42,7 +42,7 @@ class AlphaNumStringListTypeTest extends \PHPUnit_Framework_TestCase
|
||||
public function testFormatAlphaNumStringListType()
|
||||
{
|
||||
$type = new AlphaNumStringListType();
|
||||
$this->assertTrue(is_array($type->getFormatedValue('FOO1,FOO_2,FOO-3')));
|
||||
$this->assertNull($type->getFormatedValue('5€'));
|
||||
$this->assertTrue(is_array($type->getFormattedValue('FOO1,FOO_2,FOO-3')));
|
||||
$this->assertNull($type->getFormattedValue('5€'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,8 +48,8 @@ class BooleanTypeTest extends \PHPUnit_Framework_TestCase
|
||||
public function testFormatBooleanType()
|
||||
{
|
||||
$booleanType = new BooleanType();
|
||||
$this->assertTrue($booleanType->getFormatedValue('yes'));
|
||||
$this->assertFalse($booleanType->getFormatedValue('no'));
|
||||
$this->assertNull($booleanType->getFormatedValue('foo'));
|
||||
$this->assertTrue($booleanType->getFormattedValue('yes'));
|
||||
$this->assertFalse($booleanType->getFormattedValue('no'));
|
||||
$this->assertNull($booleanType->getFormattedValue('foo'));
|
||||
}
|
||||
}
|
||||
|
||||
50
core/lib/Thelia/Tests/Type/EnumListTypeTest.php
Executable file
50
core/lib/Thelia/Tests/Type/EnumListTypeTest.php
Executable file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/*************************************************************************************/
|
||||
/* */
|
||||
/* Thelia */
|
||||
/* */
|
||||
/* Copyright (c) OpenStudio */
|
||||
/* email : info@thelia.net */
|
||||
/* web : http://www.thelia.net */
|
||||
/* */
|
||||
/* This program 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 */
|
||||
/* */
|
||||
/* This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
/* */
|
||||
/*************************************************************************************/
|
||||
|
||||
namespace Thelia\Tests\Type;
|
||||
|
||||
use Thelia\Type\EnumListType;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Etienne Roudeix <eroudeix@openstudio.fr>
|
||||
*
|
||||
*/
|
||||
class EnumListTypeTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testEnumListType()
|
||||
{
|
||||
$enumListType = new EnumListType(array("cat", "dog", "frog"));
|
||||
$this->assertTrue($enumListType->isValid('cat'));
|
||||
$this->assertTrue($enumListType->isValid('cat,dog'));
|
||||
$this->assertFalse($enumListType->isValid('potato'));
|
||||
$this->assertFalse($enumListType->isValid('cat,monkey'));
|
||||
}
|
||||
|
||||
public function testFormatEnumListType()
|
||||
{
|
||||
$enumListType = new EnumListType(array("cat", "dog", "frog"));
|
||||
$this->assertTrue(is_array($enumListType->getFormattedValue('cat,dog')));
|
||||
$this->assertNull($enumListType->getFormattedValue('cat,monkey'));
|
||||
}
|
||||
}
|
||||
@@ -43,7 +43,7 @@ class IntListTypeTest extends \PHPUnit_Framework_TestCase
|
||||
public function testFormatIntListType()
|
||||
{
|
||||
$intListType = new IntListType();
|
||||
$this->assertTrue(is_array($intListType->getFormatedValue('1,2,3')));
|
||||
$this->assertNull($intListType->getFormatedValue('foo'));
|
||||
$this->assertTrue(is_array($intListType->getFormattedValue('1,2,3')));
|
||||
$this->assertNull($intListType->getFormattedValue('foo'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ class JsonTypeTest extends \PHPUnit_Framework_TestCase
|
||||
public function testFormatJsonType()
|
||||
{
|
||||
$jsonType = new JsonType();
|
||||
$this->assertTrue(is_array($jsonType->getFormatedValue('{"k0":"v0","k1":"v1","k2":"v2"}')));
|
||||
$this->assertNull($jsonType->getFormatedValue('foo'));
|
||||
$this->assertTrue(is_array($jsonType->getFormattedValue('{"k0":"v0","k1":"v1","k2":"v2"}')));
|
||||
$this->assertNull($jsonType->getFormattedValue('foo'));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user