PHP Classes

File: tests/unit/Model/Form/FieldTest.php

Recommend this page to a friend!
  Packages of Haseeb Ahmad Basil   PHP Skeleton Framework   tests/unit/Model/Form/FieldTest.php   Download  
File: tests/unit/Model/Form/FieldTest.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: 877 bytes
 

Contents

Class file image Download
<?php

class Model_Form_FieldTest extends UnitTestCase {
    
    function setUp() {
    }
    
    function TearDown() {
    }
    
    function testModel_Form_FieldNotNull() {
          $form = new A_Model_Form();
        $field = new A_Model_Form_Field('foo');
        
        $result = true;
          $this->assertTrue($result);
        $this->assertFalse(!$result);
    }
    
    function testRender() {
        $field = new A_Model_Form_Field('foo');
        $field->setValue('bar');
        
        $renderer = new MockRenderer();
        $field->setRenderer($renderer);
        $field->render();
        
        $data = $renderer->getData();
        $this->assertEqual('foo', $data['name']);
        $this->assertEqual('bar', $data['value']);
    }
    
}

class MockRenderer {
    private $data;
    public function import($data) {
        $this->data = $data;
    }
    public function getData() {
        return $this->data;
    }
    public function render() {
        return null;
    }
}