Login   Register  
PHP Classes
elePHPant
Icontem

File: tests/src/Melody/Validation/Constraints/AlnumTest.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Marcelo Santos  >  Melody Validation  >  tests/src/Melody/Validation/Constraints/AlnumTest.php  >  Download  
File: tests/src/Melody/Validation/Constraints/AlnumTest.php
Role: Unit test script
Content type: text/plain
Description: Unit test script
Class: Melody Validation
Validate values according to many types of rules
Author: By
Last change:
Date: 2013-10-17 20:23
Size: 693 bytes
 

Contents

Class file image Download
<?php

namespace Melody\Validation\Constraints;

use 
Melody\Validation\Validator as v;
use 
Melody\Validation\Exceptions\AlnumException;

class 
AlnumTest extends \PHPUnit_Framework_TestCase
{

    public function 
test_valid_string_should_pass()
    {
        
$this->assertTrue(v::alnum()->validate('abcdef0123'));
    }

    public function 
test_invalid_string_should_fail_validation()
    {
        
$this->assertFalse(v::alnum()->validate(' abcdef0123'));
    }

    public function 
test_invalid_string_exception_messages()
    {
        
$this->setExpectedException('InvalidArgumentException');
        
$this->assertInstanceOf('InvalidArgumentException'v::alnum()->validate(null));
    }
}