PHP Classes

File: tests/unit/Rule/NotnullTest.php

Recommend this page to a friend!
  Classes of Haseeb Ahmad Basil   PHP Skeleton Framework   tests/unit/Rule/NotnullTest.php   Download  
File: tests/unit/Rule/NotnullTest.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: 8 years ago
Size: 745 bytes
 

Contents

Class file image Download
<?php

class Rule_NotnullTest extends UnitTestCase {
   
    function
setUp() {
    }
   
    function
TearDown() {
    }
   
    function
testRule_NotnullNotNull() {
       
$dataspace = new A_Collection();

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

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

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

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

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