miniflux-legacy/vendor/fguillot/simple-validator/tests/RequiredValidatorTest.php

22 lines
620 B
PHP
Raw Normal View History

<?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')));
}
2015-04-11 02:34:48 +02:00
}