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.

34 lines
1013 B

  1. <?php
  2. /*
  3. * @copyright NetMonsters <team@netmonsters.ru>
  4. * @link http://netmonsters.ru
  5. * @package Majestic
  6. * @subpackage UnitTests
  7. * @since 2011-10-07
  8. *
  9. * Unit tests for RegexValdator class
  10. */
  11. require_once dirname(__FILE__) . '/../../validator/iValidator.php';
  12. require_once dirname(__FILE__) . '/../../validator/Validator.php';
  13. require_once dirname(__FILE__) . '/../../validator/EqualValidator.php';
  14. require_once dirname(__FILE__) . '/../../exception/InitializationException.php';
  15. class EqualValidatorTest extends PHPUnit_Framework_TestCase
  16. {
  17. public function testConstructor()
  18. {
  19. $validator = new EqualValidator('token');
  20. $this->assertFalse($validator->isValid('not token'));
  21. $this->assertTrue($validator->isValid('token'));
  22. }
  23. public function testNullToken()
  24. {
  25. $validator = new EqualValidator(null);
  26. $this->setExpectedException('InitializationException','Token not defined');
  27. $validator->isValid('not token');
  28. }
  29. }