PHP Classes

File: tests/unit/Rule/NotemptyTest.php

Recommend this page to a friend!
  Packages of Haseeb Ahmad Basil   PHP Skeleton Framework   tests/unit/Rule/NotemptyTest.php   Download  
File: tests/unit/Rule/NotemptyTest.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Skeleton Framework
Extensive Web application development framework
Author: By
Last change:
Date: 10 years ago
Size: 693 bytes
 

Contents

Class file image Download
<?php

class Rule_NotemptyTest extends UnitTestCase {
    
    function testRule_NotemptyValidate() {
        $dataspace = new A_Collection();

        $rule = new A_Rule_Notempty('foo', 'foo error');
        
        $this->assertFalse($rule->isValid($dataspace));
        
        $dataspace->set('foo', '');        
        $this->assertFalse($rule->isValid($dataspace));

        $dataspace->set('foo', 0);        
        $this->assertFalse($rule->isValid($dataspace));

        $dataspace->set('foo', false);        
        $this->assertFalse($rule->isValid($dataspace));

        $dataspace->set('foo', '0');        
        $this->assertFalse($rule->isValid($dataspace));

        $dataspace->set('foo', 'foo');        
        $this->assertTrue($rule->isValid($dataspace));
    }
    
}