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.

36 lines
951 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. class EqualValidatorTest extends PHPUnit_Framework_TestCase
  15. {
  16. public function testConstructor()
  17. {
  18. $validator = new EqualValidator('token');
  19. $this->assertFalse($validator->isValid('not token'));
  20. $this->assertTrue($validator->isValid('token'));
  21. }
  22. /**
  23. * @expectedException Exception
  24. * @expectedExceptionMessage Token not defined
  25. */
  26. public function testNullToken()
  27. {
  28. $validator = new EqualValidator(null);
  29. $validator->isValid('not token');
  30. }
  31. }