Created
March 20, 2012 01:29
-
-
Save donaldducky/2129601 to your computer and use it in GitHub Desktop.
Set template test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// tests/library/Respect/Validation/ValidatorTest.php | |
namespace Respect\Validation; | |
class ValidatorTest extends \PHPUnit_Framework_TestCase | |
{ | |
function test_static_create_should_return_new_validator() | |
{ | |
$this->assertInstanceOf('Respect\Validation\Validator', Validator::create()); | |
} | |
function test_invalid_rule_class_should_throw_component_exception() | |
{ | |
$this->setExpectedException('Respect\Validation\Exceptions\ComponentException'); | |
Validator::iDoNotExistSoIShouldThrowException(); | |
} | |
function test_set_template() { | |
try { | |
Validator::callback('is_int')->setTemplate('{{name}} is not tasty')->assert('something'); | |
} catch (\Exception $e) { | |
$this->assertEquals('"something" is not tasty', $e->getMainMessage()); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Respect/Validation#64
Ran this in the tests directory:
phpunit --filter test_set_template .
Assume it should use the "...is not tasty" template but it returns "...must be valid"