miniflux-legacy/vendor/fguillot/simple-validator/tests/RequiredValidatorTest.php
2015-04-10 20:34:48 -04:00

22 lines
620 B
PHP

<?php
use SimpleValidator\Validators\Required;
class RequiredValidatorTest extends PHPUnit_Framework_TestCase
{
public function testValidator()
{
$message = 'field required';
$v = new Required('toto', $message);
$this->assertEquals($message, $v->getErrorMessage());
$this->assertFalse($v->execute(array()));
$this->assertFalse($v->execute(array('toto' => '')));
$this->assertFalse($v->execute(array('toto' => null)));
$this->assertTrue($v->execute(array('toto' => 0)));
$this->assertTrue($v->execute(array('toto' => 'test')));
}
}