* @link http://netmonsters.ru * @package Majestic * @subpackage Form * @since 2010-04-25 * @version SVN: $Id$ * @filesource $URL$ */ require_once '/var/www/majesticV/lib/core/form/Form.php'; require_once '/var/www/majesticV/lib/core/form/FormField.php'; require_once '/var/www/majesticV/lib/core/view/iView.php'; require_once '/var/www/majesticV/lib/core/view/PHPView.php'; require_once '/var/www/majesticV/lib/core/view/helpers/ViewHelper.php'; require_once '/var/www/majesticV/lib/core/form/FormViewHelper.php'; require_once '/var/www/majesticV/lib/core/session/Session.php'; class FormViewHelperTest extends PHPUnit_Framework_TestCase { public function setUp() { Session::start(); $phpview = new PHPView(array('path' => 'document_root')); $this->form = new FormViewHelper($phpview); $_SESSION['path'] = array( 'values'=>array( 'path'=>'path' ), 'messages'=>array( 'path'=>'path' ) ); } public function testForm2() { $this->assertNull($this->assertAttributeEquals(null,'data',$this->form)); $this->setExpectedException('Exception'); $this->form->form(null); } public function testForm1() { $this->assertNull($this->assertAttributeEquals(null,'data',$this->form)); //аналог getProp $this->form->form('path'); } public function testValueIsset() { $this->form->form('path'); $this->assertEquals('path', $this->form->value('path')); } public function testValueNotIsset() { $this->form->form('path'); $this->assertEquals('param2', $this->form->value('param1','param2')); } public function testMessageIsset() { $this->form->form('path'); $this->assertNotEmpty($this->form->message('path')); } public function testMessageNotIsset() { $this->form->form('path'); $this->assertEmpty($this->form->message('')); } }