2012-07-12 20:40:06 -04:00
|
|
|
<?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 . 'workflow/engine/classes/class.pmScript.php';
|
|
|
|
|
|
|
|
|
|
/**
|
2012-07-12 22:34:02 -04:00
|
|
|
* Generated by ProcessMaker Test Unit Generator on 2012-07-12 at 22:32:32.
|
2012-07-12 20:40:06 -04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
class classPMScriptTest extends PHPUnit_Framework_TestCase
|
|
|
|
|
{
|
2012-05-10 20:57:25 -04:00
|
|
|
/**
|
2012-07-12 20:40:06 -04:00
|
|
|
* @var PMScript
|
2012-05-10 20:57:25 -04:00
|
|
|
*/
|
2012-07-12 20:40:06 -04:00
|
|
|
protected $object;
|
2012-05-10 20:57:25 -04:00
|
|
|
|
|
|
|
|
/**
|
2012-07-12 20:40:06 -04:00
|
|
|
* Sets up the fixture, for example, opens a network connection.
|
|
|
|
|
* This method is called before a test is executed.
|
2012-05-10 20:57:25 -04:00
|
|
|
*/
|
2012-07-12 20:40:06 -04:00
|
|
|
protected function setUp()
|
|
|
|
|
{
|
|
|
|
|
$this->object = new PMScript();
|
|
|
|
|
}
|
2012-05-10 20:57:25 -04:00
|
|
|
|
|
|
|
|
/**
|
2012-07-12 20:40:06 -04:00
|
|
|
* Tears down the fixture, for example, closes a network connection.
|
|
|
|
|
* This method is called after a test is executed.
|
2012-05-10 20:57:25 -04:00
|
|
|
*/
|
2012-07-12 20:40:06 -04:00
|
|
|
protected function tearDown()
|
|
|
|
|
{
|
|
|
|
|
}
|
2012-05-10 20:57:25 -04:00
|
|
|
|
|
|
|
|
/**
|
2012-07-13 18:51:49 -04:00
|
|
|
* This is the default method to test, if the class still having
|
2012-07-12 20:40:06 -04:00
|
|
|
* the same number of methods.
|
2012-05-10 20:57:25 -04:00
|
|
|
*/
|
2012-07-12 20:40:06 -04:00
|
|
|
public function testNumberOfMethodsInThisClass()
|
|
|
|
|
{
|
2012-07-13 18:51:49 -04:00
|
|
|
$methods = get_class_methods('PMScript');
|
|
|
|
|
$this->assertTrue(count($methods) == 7);
|
2012-07-12 20:40:06 -04:00
|
|
|
}
|
2012-05-10 20:57:25 -04:00
|
|
|
|
|
|
|
|
/**
|
2012-07-12 20:40:06 -04:00
|
|
|
* @covers PMScript::PMScript
|
|
|
|
|
* @todo Implement testPMScript().
|
2012-05-10 20:57:25 -04:00
|
|
|
*/
|
2012-07-12 20:40:06 -04:00
|
|
|
public function testPMScript()
|
|
|
|
|
{
|
|
|
|
|
$methods = get_class_methods($this->object);
|
|
|
|
|
$this->assertTrue( in_array('PMScript', $methods ), 'exists method PMScript' );
|
|
|
|
|
$r = new ReflectionMethod('PMScript', 'PMScript');
|
|
|
|
|
$params = $r->getParameters();
|
2012-07-13 18:51:49 -04:00
|
|
|
}
|
2012-05-10 20:57:25 -04:00
|
|
|
|
|
|
|
|
/**
|
2012-07-12 20:40:06 -04:00
|
|
|
* @covers PMScript::setFields
|
|
|
|
|
* @todo Implement testsetFields().
|
2012-05-10 20:57:25 -04:00
|
|
|
*/
|
2012-07-12 20:40:06 -04:00
|
|
|
public function testsetFields()
|
|
|
|
|
{
|
|
|
|
|
$methods = get_class_methods($this->object);
|
|
|
|
|
$this->assertTrue( in_array('setFields', $methods ), 'exists method setFields' );
|
|
|
|
|
$r = new ReflectionMethod('PMScript', 'setFields');
|
|
|
|
|
$params = $r->getParameters();
|
2012-07-13 18:51:49 -04:00
|
|
|
$this->assertTrue($params[0]->getName() == 'aFields');
|
|
|
|
|
$this->assertTrue($params[0]->isArray() == false);
|
|
|
|
|
$this->assertTrue($params[0]->isOptional () == true);
|
|
|
|
|
$this->assertTrue($params[0]->getDefaultValue() == array());
|
|
|
|
|
}
|
2012-05-10 20:57:25 -04:00
|
|
|
|
|
|
|
|
/**
|
2012-07-12 20:40:06 -04:00
|
|
|
* @covers PMScript::setScript
|
|
|
|
|
* @todo Implement testsetScript().
|
2012-05-10 20:57:25 -04:00
|
|
|
*/
|
2012-07-12 20:40:06 -04:00
|
|
|
public function testsetScript()
|
|
|
|
|
{
|
|
|
|
|
$methods = get_class_methods($this->object);
|
|
|
|
|
$this->assertTrue( in_array('setScript', $methods ), 'exists method setScript' );
|
|
|
|
|
$r = new ReflectionMethod('PMScript', 'setScript');
|
|
|
|
|
$params = $r->getParameters();
|
|
|
|
|
$this->assertTrue( $params[0]->getName() == 'sScript');
|
|
|
|
|
$this->assertTrue( $params[0]->isArray() == false);
|
|
|
|
|
$this->assertTrue( $params[0]->isOptional () == true);
|
|
|
|
|
$this->assertTrue( $params[0]->getDefaultValue() == '');
|
2012-07-13 18:51:49 -04:00
|
|
|
}
|
2012-05-10 20:57:25 -04:00
|
|
|
|
|
|
|
|
/**
|
2012-07-12 20:40:06 -04:00
|
|
|
* @covers PMScript::validSyntax
|
|
|
|
|
* @todo Implement testvalidSyntax().
|
2012-05-10 20:57:25 -04:00
|
|
|
*/
|
2012-07-12 20:40:06 -04:00
|
|
|
public function testvalidSyntax()
|
|
|
|
|
{
|
|
|
|
|
$methods = get_class_methods($this->object);
|
|
|
|
|
$this->assertTrue( in_array('validSyntax', $methods ), 'exists method validSyntax' );
|
|
|
|
|
$r = new ReflectionMethod('PMScript', 'validSyntax');
|
|
|
|
|
$params = $r->getParameters();
|
|
|
|
|
$this->assertTrue( $params[0]->getName() == 'sScript');
|
|
|
|
|
$this->assertTrue( $params[0]->isArray() == false);
|
|
|
|
|
$this->assertTrue( $params[0]->isOptional () == false);
|
2012-07-13 18:51:49 -04:00
|
|
|
}
|
2012-05-10 20:57:25 -04:00
|
|
|
|
|
|
|
|
/**
|
2012-07-12 20:40:06 -04:00
|
|
|
* @covers PMScript::executeAndCatchErrors
|
|
|
|
|
* @todo Implement testexecuteAndCatchErrors().
|
2012-05-10 20:57:25 -04:00
|
|
|
*/
|
2012-07-12 20:40:06 -04:00
|
|
|
public function testexecuteAndCatchErrors()
|
|
|
|
|
{
|
|
|
|
|
$methods = get_class_methods($this->object);
|
|
|
|
|
$this->assertTrue( in_array('executeAndCatchErrors', $methods ), 'exists method executeAndCatchErrors' );
|
|
|
|
|
$r = new ReflectionMethod('PMScript', 'executeAndCatchErrors');
|
|
|
|
|
$params = $r->getParameters();
|
|
|
|
|
$this->assertTrue( $params[0]->getName() == 'sScript');
|
|
|
|
|
$this->assertTrue( $params[0]->isArray() == false);
|
|
|
|
|
$this->assertTrue( $params[0]->isOptional () == false);
|
|
|
|
|
$this->assertTrue( $params[1]->getName() == 'sCode');
|
|
|
|
|
$this->assertTrue( $params[1]->isArray() == false);
|
|
|
|
|
$this->assertTrue( $params[1]->isOptional () == false);
|
2012-07-13 18:51:49 -04:00
|
|
|
}
|
2012-05-10 20:57:25 -04:00
|
|
|
|
|
|
|
|
/**
|
2012-07-12 20:40:06 -04:00
|
|
|
* @covers PMScript::execute
|
|
|
|
|
* @todo Implement testexecute().
|
2012-05-10 20:57:25 -04:00
|
|
|
*/
|
2012-07-12 20:40:06 -04:00
|
|
|
public function testexecute()
|
|
|
|
|
{
|
|
|
|
|
$methods = get_class_methods($this->object);
|
|
|
|
|
$this->assertTrue( in_array('execute', $methods ), 'exists method execute' );
|
|
|
|
|
$r = new ReflectionMethod('PMScript', 'execute');
|
|
|
|
|
$params = $r->getParameters();
|
2012-07-13 18:51:49 -04:00
|
|
|
}
|
2012-05-10 20:57:25 -04:00
|
|
|
|
|
|
|
|
/**
|
2012-07-12 20:40:06 -04:00
|
|
|
* @covers PMScript::evaluate
|
|
|
|
|
* @todo Implement testevaluate().
|
2012-05-10 20:57:25 -04:00
|
|
|
*/
|
2012-07-12 20:40:06 -04:00
|
|
|
public function testevaluate()
|
|
|
|
|
{
|
|
|
|
|
$methods = get_class_methods($this->object);
|
|
|
|
|
$this->assertTrue( in_array('evaluate', $methods ), 'exists method evaluate' );
|
|
|
|
|
$r = new ReflectionMethod('PMScript', 'evaluate');
|
|
|
|
|
$params = $r->getParameters();
|
2012-07-13 18:51:49 -04:00
|
|
|
}
|
|
|
|
|
}
|
2012-05-10 20:57:25 -04:00
|
|
|
|