PHP Classes

File: tests/unit/Rule/SetTest.php

Recommend this page to a friend!
  Classes of Haseeb Ahmad Basil   PHP Skeleton Framework   tests/unit/Rule/SetTest.php   Download  
File: tests/unit/Rule/SetTest.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: 1,212 bytes
 

Contents

Class file image Download
<?php

class Rule_SetTest extends UnitTestCase {
   
    protected
$data = array(
       
'test' => '1234ambcAZAZAZ'
   
);
   
    function
setUp() {
    }
   
    function
TearDown() {
    }
   
    function
testRule_SetRuleObject() {
       
$dataspace = new A_Collection();

       
$rules = new A_Rule_Set();
       
//$dataspace = new A_Collection();

        
$rule = new A_Rule_Notnull(array('field' => 'test', 'errorMsg' => 'error'));
       
$rules->addRule($rule);
       
$result = $rules->isValid(array());
       
$this->assertFalse($result);

       
$result = $rules->isValid($this->data);
       
$this->assertTrue($result);
    }
/*
    function testRule_SetRuleName() {
        $rules = new A_Rule_Set();
        $dataspace = new A_Collection();

        // should load A_Rule_Numeric
        $rules->addRule('numeric', 'test', 'not a number');

         $dataspace->set('test', 'test123');
         $this->assertFalse($rules->validate($dataspace));
         $this->assertEqual($rules->getErrorMsg(), array(0=>'not a number'));
        
         $dataspace->set('test', '123');
        $this->assertTrue($rules->validate($dataspace));
         $this->assertEqual($rules->getErrorMsg(), array());
       
         $dataspace->set('test', 123);
        $this->assertTrue($rules->validate($dataspace));
    }*/

}