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

35 lines
1.4 KiB
PHP
Raw Normal View History

2015-01-28 02:13:16 +01:00
<?php
require_once 'src/SimpleValidator/Base.php';
require_once 'src/SimpleValidator/Validators/Email.php';
use SimpleValidator\Validators\NotEquals;
class EmailValidatorTest extends PHPUnit_Framework_TestCase
{
public function testValidator()
{
$message = 'should not be equal';
$v = new NotEquals('toto', 'titi', $message);
$this->assertEquals($message, $v->getErrorMessage());
$this->assertFalse($v->execute(array('toto' => 'test', 'titi' => 'test')));
$this->assertTrue($v->execute(array('toto' => 'test', 'titi' => 'testest')));
$this->assertTrue($v->execute(array('toto' => 'test')));
$this->assertTrue($v->execute(array('toto' => 'test', 'titi' => '')));
$this->assertTrue($v->execute(array('toto' => 'test', 'titi' => null)));
$this->assertTrue($v->execute(array('toto' => 'test')));
$this->assertTrue($v->execute(array('toto' => '', 'titi' => 'test')));
$this->assertTrue($v->execute(array('toto' => null, 'titi' => 'test')));
$this->assertTrue($v->execute(array('titi' => 'test')));
$this->assertTrue($v->execute(array()));
$this->assertTrue($v->execute(array('toto' => '')));
$this->assertTrue($v->execute(array('toto' => null)));
$this->assertTrue($v->execute(array('titi' => '')));
$this->assertTrue($v->execute(array('titi' => null)));
}
}