You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
84 lines
2.3 KiB
84 lines
2.3 KiB
<?php
|
|
/**
|
|
* @copyright NetMonsters <team@netmonsters.ru>
|
|
* @link http://netmonsters.ru
|
|
* @package Majestic
|
|
* @subpackage Form
|
|
* @since 2010-04-25
|
|
* @version SVN: $Id$
|
|
* @filesource $URL$
|
|
*/
|
|
|
|
require_once dirname(__FILE__) . '/../../form/Form.php';
|
|
require_once dirname(__FILE__) . '/../../form/FormField.php';
|
|
|
|
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('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(''));
|
|
}
|
|
}
|