1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/kanboard_ynh.git synced 2024-09-03 19:36:17 +02:00
kanboard_ynh/sources/vendor/fguillot/simple-validator/tests/AlphaNumericTest.php
2014-12-22 19:15:38 +01:00

27 lines
942 B
PHP

<?php
require_once 'src/SimpleValidator/Base.php';
require_once 'src/SimpleValidator/Validators/AlphaNumeric.php';
use SimpleValidator\Validators\AlphaNumeric;
class AlphaNumericValidatorTest extends PHPUnit_Framework_TestCase
{
public function testValidator()
{
$message = 'field must be numeric';
$v = new AlphaNumeric('toto', $message);
$this->assertEquals($message, $v->getErrorMessage());
$this->assertTrue($v->execute(array('toto' => '')));
$this->assertTrue($v->execute(array('toto' => null)));
$this->assertTrue($v->execute(array('toto' => 'abc123')));
$this->assertTrue($v->execute(array()));
$this->assertFalse($v->execute(array('toto' => '123.4')));
$this->assertFalse($v->execute(array('toto' => 123)));
$this->assertFalse($v->execute(array('toto' => 123)));
$this->assertFalse($v->execute(array('toto' => 'hjh-hjh')));
}
}