* @link http://netmonsters.ru * @package Majestic * @subpackage Form * @since 2010-04-25 * @version SVN: $Id$ * @filesource $URL$ */ require_once dirname(__FILE__) . '/../../view/iView.php'; require_once dirname(__FILE__) . '/../../view/PHPView.php'; require_once dirname(__FILE__) . '/../../view/helpers/ViewHelper.php'; require_once dirname(__FILE__) . '/../../form/FormViewHelper.php'; require_once dirname(__FILE__) . '/../../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(htmlentities('path', ENT_QUOTES, 'UTF-8'), $this->form->value('path')); } public function testValueNotIsset() { $this->form->form('path'); $this->assertEquals(htmlentities('param2', ENT_QUOTES, 'UTF-8'), $this->form->value('param1','param2')); } public function testMessageIsset() { $this->form->form('path'); $this->assertEquals('' . htmlentities('path', ENT_QUOTES, 'UTF-8') . '', $this->form->message('path')); } public function testMessageNotIsset() { $this->form->form('path'); $this->assertEmpty($this->form->message('')); } }