You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
1.1 KiB

<?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/NotEmptyValidator.php';
class NotEmptyValidatorTest extends PHPUnit_Framework_TestCase
{
public function testValidator()
{
$validator = new NotEmptyValidator();
$this->assertFalse($validator->isValid(''));
$this->assertTrue($validator->isValid('token'));
$this->assertTrue($validator->isValid(1212));
$this->assertTrue($validator->isValid(array(1,2,2)));
$this->assertFalse($validator->isValid(array()));
$this->assertNotEmpty($validator->getMessage());
}
public function testEmptyValue()
{
$validator = new NotEmptyValidator(null);
$this->assertFalse($validator->isValid(null));
}
}