Validator classes tested
This commit is contained in:
36
tests/validator/EqualValidatorTest.php
Normal file
36
tests/validator/EqualValidatorTest.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright NetMonsters <team@netmonsters.ru>
|
||||
* @link http://netmonsters.ru
|
||||
* @package Majestic
|
||||
* @subpackage UnitTests
|
||||
* @since 2011-10-07
|
||||
*
|
||||
* Unit tests for RegexValdator class
|
||||
*/
|
||||
|
||||
require_once dirname(__FILE__) . '/../../validator/iValidator.php';
|
||||
require_once dirname(__FILE__) . '/../../validator/Validator.php';
|
||||
require_once dirname(__FILE__) . '/../../validator/EqualValidator.php';
|
||||
|
||||
class EqualValidatorTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testConstructor()
|
||||
{
|
||||
$validator = new EqualValidator('token');
|
||||
$this->assertFalse($validator->isValid('not token'));
|
||||
$this->assertTrue($validator->isValid('token'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Exception
|
||||
*/
|
||||
public function testNullToken()
|
||||
{
|
||||
$validator = new EqualValidator(null);
|
||||
$validator->isValid('not token');
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user