243 lines
9.4 KiB
PHP
243 lines
9.4 KiB
PHP
<?php
|
|
require_once PATH_TRUNK . 'gulliver/thirdparty/smarty/libs/Smarty.class.php';
|
|
require_once PATH_TRUNK . 'gulliver/system/class.xmlform.php';
|
|
require_once PATH_TRUNK . 'gulliver/system/class.xmlDocument.php';
|
|
require_once PATH_TRUNK . 'gulliver/system/class.form.php';
|
|
require_once PATH_TRUNK . 'gulliver/system/class.dbconnection.php';
|
|
require_once PATH_TRUNK . 'gulliver/thirdparty/propel/Propel.php';
|
|
require_once PATH_TRUNK . 'gulliver/thirdparty/creole/Creole.php';
|
|
require_once PATH_TRUNK . 'gulliver/thirdparty/pear/PEAR.php';
|
|
require_once PATH_TRUNK . 'gulliver/system/class.form.php';
|
|
|
|
/**
|
|
* Generated by ProcessMaker Test Unit Generator on 2012-07-12 at 22:32:22.
|
|
*/
|
|
|
|
class classFormTest extends PHPUnit_Framework_TestCase
|
|
{
|
|
/**
|
|
* @var Form
|
|
*/
|
|
protected $object;
|
|
|
|
/**
|
|
* Sets up the fixture, for example, opens a network connection.
|
|
* This method is called before a test is executed.
|
|
*/
|
|
protected function setUp()
|
|
{
|
|
$file='login/login';
|
|
$home=PATH_TRUNK . 'workflow/engine/xmlform/';
|
|
$this->object = new Form($file, $home);
|
|
}
|
|
|
|
/**
|
|
* Tears down the fixture, for example, closes a network connection.
|
|
* This method is called after a test is executed.
|
|
*/
|
|
protected function tearDown()
|
|
{
|
|
}
|
|
|
|
/**
|
|
* This is the default method to test, if the class still having
|
|
* the same number of methods.
|
|
*/
|
|
public function testNumberOfMethodsInThisClass()
|
|
{
|
|
$methods = get_class_methods('Form'); $this->assertTrue( count($methods) == 13);
|
|
}
|
|
|
|
/**
|
|
* @covers Form::setDefaultValues
|
|
* @todo Implement testsetDefaultValues().
|
|
*/
|
|
public function testsetDefaultValues()
|
|
{
|
|
$methods = get_class_methods($this->object);
|
|
$this->assertTrue( in_array('setDefaultValues', $methods ), 'exists method setDefaultValues' );
|
|
$r = new ReflectionMethod('Form', 'setDefaultValues');
|
|
$params = $r->getParameters();
|
|
}
|
|
|
|
/**
|
|
* @covers Form::Form
|
|
* @todo Implement testForm().
|
|
*/
|
|
public function testForm()
|
|
{
|
|
$methods = get_class_methods($this->object);
|
|
$this->assertTrue( in_array('Form', $methods ), 'exists method Form' );
|
|
$r = new ReflectionMethod('Form', 'Form');
|
|
$params = $r->getParameters();
|
|
$this->assertTrue( $params[0]->getName() == 'filename');
|
|
$this->assertTrue( $params[0]->isArray() == false);
|
|
$this->assertTrue( $params[0]->isOptional () == false);
|
|
$this->assertTrue( $params[1]->getName() == 'home');
|
|
$this->assertTrue( $params[1]->isArray() == false);
|
|
$this->assertTrue( $params[1]->isOptional () == true);
|
|
$this->assertTrue( $params[1]->getDefaultValue() == '');
|
|
$this->assertTrue( $params[2]->getName() == 'language');
|
|
$this->assertTrue( $params[2]->isArray() == false);
|
|
$this->assertTrue( $params[2]->isOptional () == true);
|
|
$this->assertTrue( $params[2]->getDefaultValue() == '');
|
|
$this->assertTrue( $params[3]->getName() == 'forceParse');
|
|
$this->assertTrue( $params[3]->isArray() == false);
|
|
$this->assertTrue( $params[3]->isOptional () == true);
|
|
$this->assertTrue( $params[3]->getDefaultValue() == '');
|
|
$this->assertTrue( $params[4]->getName() == 'visual_frontend');
|
|
$this->assertTrue( $params[4]->isArray() == false);
|
|
$this->assertTrue( $params[4]->isOptional () == true);
|
|
$this->assertTrue( $params[4]->getDefaultValue() == '');
|
|
}
|
|
|
|
/**
|
|
* @covers Form::printTemplate
|
|
* @todo Implement testprintTemplate().
|
|
*/
|
|
public function testprintTemplate()
|
|
{
|
|
$methods = get_class_methods($this->object);
|
|
$this->assertTrue( in_array('printTemplate', $methods ), 'exists method printTemplate' );
|
|
$r = new ReflectionMethod('Form', 'printTemplate');
|
|
$params = $r->getParameters();
|
|
$this->assertTrue( $params[0]->getName() == 'template');
|
|
$this->assertTrue( $params[0]->isArray() == false);
|
|
$this->assertTrue( $params[0]->isOptional () == false);
|
|
$this->assertTrue( $params[1]->getName() == 'scriptContent');
|
|
$this->assertTrue( $params[1]->isArray() == false);
|
|
$this->assertTrue( $params[1]->isOptional () == false);
|
|
}
|
|
|
|
/**
|
|
* @covers Form::render
|
|
* @todo Implement testrender().
|
|
*/
|
|
public function testrender()
|
|
{
|
|
$methods = get_class_methods($this->object);
|
|
$this->assertTrue( in_array('render', $methods ), 'exists method render' );
|
|
$r = new ReflectionMethod('Form', 'render');
|
|
$params = $r->getParameters();
|
|
$this->assertTrue( $params[0]->getName() == 'template');
|
|
$this->assertTrue( $params[0]->isArray() == false);
|
|
$this->assertTrue( $params[0]->isOptional () == false);
|
|
$this->assertTrue( $params[1]->getName() == 'scriptContent');
|
|
$this->assertTrue( $params[1]->isArray() == false);
|
|
$this->assertTrue( $params[1]->isOptional () == false);
|
|
}
|
|
|
|
/**
|
|
* @covers Form::setValues
|
|
* @todo Implement testsetValues().
|
|
*/
|
|
public function testsetValues()
|
|
{
|
|
$methods = get_class_methods($this->object);
|
|
$this->assertTrue( in_array('setValues', $methods ), 'exists method setValues' );
|
|
$r = new ReflectionMethod('Form', 'setValues');
|
|
$params = $r->getParameters();
|
|
$this->assertTrue( $params[0]->getName() == 'newValues');
|
|
$this->assertTrue( $params[0]->isArray() == false);
|
|
$this->assertTrue( $params[0]->isOptional () == true);
|
|
$this->assertTrue( $params[0]->getDefaultValue() == array());
|
|
}
|
|
|
|
/**
|
|
* @covers Form::getFields
|
|
* @todo Implement testgetFields().
|
|
*/
|
|
public function testgetFields()
|
|
{
|
|
$methods = get_class_methods($this->object);
|
|
$this->assertTrue( in_array('getFields', $methods ), 'exists method getFields' );
|
|
$r = new ReflectionMethod('Form', 'getFields');
|
|
$params = $r->getParameters();
|
|
$this->assertTrue( $params[0]->getName() == 'template');
|
|
$this->assertTrue( $params[0]->isArray() == false);
|
|
$this->assertTrue( $params[0]->isOptional () == false);
|
|
$this->assertTrue( $params[1]->getName() == 'therow');
|
|
$this->assertTrue( $params[1]->isArray() == false);
|
|
$this->assertTrue( $params[1]->isOptional () == true);
|
|
$this->assertTrue( $params[1]->getDefaultValue() == '-1');
|
|
}
|
|
|
|
/**
|
|
* @covers Form::validatePost
|
|
* @todo Implement testvalidatePost().
|
|
*/
|
|
public function testvalidatePost()
|
|
{
|
|
$methods = get_class_methods($this->object);
|
|
$this->assertTrue( in_array('validatePost', $methods ), 'exists method validatePost' );
|
|
$r = new ReflectionMethod('Form', 'validatePost');
|
|
$params = $r->getParameters();
|
|
}
|
|
|
|
/**
|
|
* @covers Form::validateArray
|
|
* @todo Implement testvalidateArray().
|
|
*/
|
|
public function testvalidateArray()
|
|
{
|
|
$methods = get_class_methods($this->object);
|
|
$this->assertTrue( in_array('validateArray', $methods ), 'exists method validateArray' );
|
|
$r = new ReflectionMethod('Form', 'validateArray');
|
|
$params = $r->getParameters();
|
|
$this->assertTrue( $params[0]->getName() == 'newValues');
|
|
$this->assertTrue( $params[0]->isArray() == false);
|
|
$this->assertTrue( $params[0]->isOptional () == false);
|
|
}
|
|
|
|
/**
|
|
* @covers Form::getVars
|
|
* @todo Implement testgetVars().
|
|
*/
|
|
public function testgetVars()
|
|
{
|
|
$methods = get_class_methods($this->object);
|
|
$this->assertTrue( in_array('getVars', $methods ), 'exists method getVars' );
|
|
$r = new ReflectionMethod('Form', 'getVars');
|
|
$params = $r->getParameters();
|
|
$this->assertTrue( $params[0]->getName() == 'bWhitSystemVars');
|
|
$this->assertTrue( $params[0]->isArray() == false);
|
|
$this->assertTrue( $params[0]->isOptional () == true);
|
|
$this->assertTrue( $params[0]->getDefaultValue() == '1');
|
|
}
|
|
|
|
/**
|
|
* @covers Form::validateRequiredFields
|
|
* @todo Implement testvalidateRequiredFields().
|
|
*/
|
|
public function testvalidateRequiredFields()
|
|
{
|
|
$methods = get_class_methods($this->object);
|
|
$this->assertTrue( in_array('validateRequiredFields', $methods ), 'exists method validateRequiredFields' );
|
|
$r = new ReflectionMethod('Form', 'validateRequiredFields');
|
|
$params = $r->getParameters();
|
|
$this->assertTrue( $params[0]->getName() == 'dataFields');
|
|
$this->assertTrue( $params[0]->isArray() == false);
|
|
$this->assertTrue( $params[0]->isOptional () == false);
|
|
$this->assertTrue( $params[1]->getName() == 'noRequired');
|
|
$this->assertTrue( $params[1]->isArray() == false);
|
|
$this->assertTrue( $params[1]->isOptional () == true);
|
|
$this->assertTrue( $params[1]->getDefaultValue() == array());
|
|
}
|
|
|
|
/**
|
|
* @covers Form::validateFields
|
|
* @todo Implement testvalidateFields().
|
|
*/
|
|
public function testvalidateFields()
|
|
{
|
|
$methods = get_class_methods($this->object);
|
|
$this->assertTrue( in_array('validateFields', $methods ), 'exists method validateFields' );
|
|
$r = new ReflectionMethod('Form', 'validateFields');
|
|
$params = $r->getParameters();
|
|
$this->assertTrue( $params[0]->getName() == 'data');
|
|
$this->assertTrue( $params[0]->isArray() == false);
|
|
$this->assertTrue( $params[0]->isOptional () == false);
|
|
}
|
|
|
|
}
|