268 lines
9.8 KiB
PHP
268 lines
9.8 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 . 'workflow/engine/classes/class.cli.php';
|
|
|
|
/**
|
|
* Generated by ProcessMaker Test Unit Generator on 2012-07-12 at 22:32:32.
|
|
*/
|
|
|
|
class classCLITest extends PHPUnit_Framework_TestCase
|
|
{
|
|
/**
|
|
* @var CLI
|
|
*/
|
|
protected $object;
|
|
|
|
/**
|
|
* Sets up the fixture, for example, opens a network connection.
|
|
* This method is called before a test is executed.
|
|
*/
|
|
protected function setUp()
|
|
{
|
|
$this->object = new CLI();
|
|
}
|
|
|
|
/**
|
|
* 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('CLI'); $this->assertTrue( count($methods) == 13);
|
|
}
|
|
|
|
/**
|
|
* @covers CLI::taskName
|
|
* @todo Implement testtaskName().
|
|
*/
|
|
public function testtaskName()
|
|
{
|
|
$methods = get_class_methods($this->object);
|
|
$this->assertTrue( in_array('taskName', $methods ), 'exists method taskName' );
|
|
$r = new ReflectionMethod('CLI', 'taskName');
|
|
$params = $r->getParameters();
|
|
$this->assertTrue( $params[0]->getName() == 'name');
|
|
$this->assertTrue( $params[0]->isArray() == false);
|
|
$this->assertTrue( $params[0]->isOptional () == false);
|
|
}
|
|
|
|
/**
|
|
* @covers CLI::taskDescription
|
|
* @todo Implement testtaskDescription().
|
|
*/
|
|
public function testtaskDescription()
|
|
{
|
|
$methods = get_class_methods($this->object);
|
|
$this->assertTrue( in_array('taskDescription', $methods ), 'exists method taskDescription' );
|
|
$r = new ReflectionMethod('CLI', 'taskDescription');
|
|
$params = $r->getParameters();
|
|
$this->assertTrue( $params[0]->getName() == 'description');
|
|
$this->assertTrue( $params[0]->isArray() == false);
|
|
$this->assertTrue( $params[0]->isOptional () == false);
|
|
}
|
|
|
|
/**
|
|
* @covers CLI::taskArg
|
|
* @todo Implement testtaskArg().
|
|
*/
|
|
public function testtaskArg()
|
|
{
|
|
$methods = get_class_methods($this->object);
|
|
$this->assertTrue( in_array('taskArg', $methods ), 'exists method taskArg' );
|
|
$r = new ReflectionMethod('CLI', 'taskArg');
|
|
$params = $r->getParameters();
|
|
$this->assertTrue( $params[0]->getName() == 'name');
|
|
$this->assertTrue( $params[0]->isArray() == false);
|
|
$this->assertTrue( $params[0]->isOptional () == false);
|
|
$this->assertTrue( $params[1]->getName() == 'optional');
|
|
$this->assertTrue( $params[1]->isArray() == false);
|
|
$this->assertTrue( $params[1]->isOptional () == true);
|
|
$this->assertTrue( $params[1]->getDefaultValue() == '1');
|
|
$this->assertTrue( $params[2]->getName() == 'multiple');
|
|
$this->assertTrue( $params[2]->isArray() == false);
|
|
$this->assertTrue( $params[2]->isOptional () == true);
|
|
$this->assertTrue( $params[2]->getDefaultValue() == '');
|
|
}
|
|
|
|
/**
|
|
* @covers CLI::taskOpt
|
|
* @todo Implement testtaskOpt().
|
|
*/
|
|
public function testtaskOpt()
|
|
{
|
|
$methods = get_class_methods($this->object);
|
|
$this->assertTrue( in_array('taskOpt', $methods ), 'exists method taskOpt' );
|
|
$r = new ReflectionMethod('CLI', 'taskOpt');
|
|
$params = $r->getParameters();
|
|
$this->assertTrue( $params[0]->getName() == 'name');
|
|
$this->assertTrue( $params[0]->isArray() == false);
|
|
$this->assertTrue( $params[0]->isOptional () == false);
|
|
$this->assertTrue( $params[1]->getName() == 'description');
|
|
$this->assertTrue( $params[1]->isArray() == false);
|
|
$this->assertTrue( $params[1]->isOptional () == false);
|
|
$this->assertTrue( $params[2]->getName() == 'short');
|
|
$this->assertTrue( $params[2]->isArray() == false);
|
|
$this->assertTrue( $params[2]->isOptional () == false);
|
|
$this->assertTrue( $params[3]->getName() == 'long');
|
|
$this->assertTrue( $params[3]->isArray() == false);
|
|
$this->assertTrue( $params[3]->isOptional () == true);
|
|
$this->assertTrue( $params[3]->getDefaultValue() == '');
|
|
}
|
|
|
|
/**
|
|
* @covers CLI::taskRun
|
|
* @todo Implement testtaskRun().
|
|
*/
|
|
public function testtaskRun()
|
|
{
|
|
$methods = get_class_methods($this->object);
|
|
$this->assertTrue( in_array('taskRun', $methods ), 'exists method taskRun' );
|
|
$r = new ReflectionMethod('CLI', 'taskRun');
|
|
$params = $r->getParameters();
|
|
$this->assertTrue( $params[0]->getName() == 'function');
|
|
$this->assertTrue( $params[0]->isArray() == false);
|
|
$this->assertTrue( $params[0]->isOptional () == false);
|
|
}
|
|
|
|
/**
|
|
* @covers CLI::help
|
|
* @todo Implement testhelp().
|
|
*/
|
|
public function testhelp()
|
|
{
|
|
$methods = get_class_methods($this->object);
|
|
$this->assertTrue( in_array('help', $methods ), 'exists method help' );
|
|
$r = new ReflectionMethod('CLI', 'help');
|
|
$params = $r->getParameters();
|
|
$this->assertTrue( $params[0]->getName() == 'args');
|
|
$this->assertTrue( $params[0]->isArray() == false);
|
|
$this->assertTrue( $params[0]->isOptional () == false);
|
|
$this->assertTrue( $params[1]->getName() == 'opts');
|
|
$this->assertTrue( $params[1]->isArray() == false);
|
|
$this->assertTrue( $params[1]->isOptional () == true);
|
|
$this->assertTrue( $params[1]->getDefaultValue() == '');
|
|
}
|
|
|
|
/**
|
|
* @covers CLI::run
|
|
* @todo Implement testrun().
|
|
*/
|
|
public function testrun()
|
|
{
|
|
$methods = get_class_methods($this->object);
|
|
$this->assertTrue( in_array('run', $methods ), 'exists method run' );
|
|
$r = new ReflectionMethod('CLI', 'run');
|
|
$params = $r->getParameters();
|
|
}
|
|
|
|
/**
|
|
* @covers CLI::info
|
|
* @todo Implement testinfo().
|
|
*/
|
|
public function testinfo()
|
|
{
|
|
$methods = get_class_methods($this->object);
|
|
$this->assertTrue( in_array('info', $methods ), 'exists method info' );
|
|
$r = new ReflectionMethod('CLI', 'info');
|
|
$params = $r->getParameters();
|
|
$this->assertTrue( $params[0]->getName() == 'message');
|
|
$this->assertTrue( $params[0]->isArray() == false);
|
|
$this->assertTrue( $params[0]->isOptional () == false);
|
|
}
|
|
|
|
/**
|
|
* @covers CLI::warning
|
|
* @todo Implement testwarning().
|
|
*/
|
|
public function testwarning()
|
|
{
|
|
$methods = get_class_methods($this->object);
|
|
$this->assertTrue( in_array('warning', $methods ), 'exists method warning' );
|
|
$r = new ReflectionMethod('CLI', 'warning');
|
|
$params = $r->getParameters();
|
|
$this->assertTrue( $params[0]->getName() == 'message');
|
|
$this->assertTrue( $params[0]->isArray() == false);
|
|
$this->assertTrue( $params[0]->isOptional () == false);
|
|
}
|
|
|
|
/**
|
|
* @covers CLI::error
|
|
* @todo Implement testerror().
|
|
*/
|
|
public function testerror()
|
|
{
|
|
$methods = get_class_methods($this->object);
|
|
$this->assertTrue( in_array('error', $methods ), 'exists method error' );
|
|
$r = new ReflectionMethod('CLI', 'error');
|
|
$params = $r->getParameters();
|
|
$this->assertTrue( $params[0]->getName() == 'message');
|
|
$this->assertTrue( $params[0]->isArray() == false);
|
|
$this->assertTrue( $params[0]->isOptional () == false);
|
|
}
|
|
|
|
/**
|
|
* @covers CLI::prompt
|
|
* @todo Implement testprompt().
|
|
*/
|
|
public function testprompt()
|
|
{
|
|
$methods = get_class_methods($this->object);
|
|
$this->assertTrue( in_array('prompt', $methods ), 'exists method prompt' );
|
|
$r = new ReflectionMethod('CLI', 'prompt');
|
|
$params = $r->getParameters();
|
|
$this->assertTrue( $params[0]->getName() == 'message');
|
|
$this->assertTrue( $params[0]->isArray() == false);
|
|
$this->assertTrue( $params[0]->isOptional () == false);
|
|
}
|
|
|
|
/**
|
|
* @covers CLI::question
|
|
* @todo Implement testquestion().
|
|
*/
|
|
public function testquestion()
|
|
{
|
|
$methods = get_class_methods($this->object);
|
|
$this->assertTrue( in_array('question', $methods ), 'exists method question' );
|
|
$r = new ReflectionMethod('CLI', 'question');
|
|
$params = $r->getParameters();
|
|
$this->assertTrue( $params[0]->getName() == 'message');
|
|
$this->assertTrue( $params[0]->isArray() == false);
|
|
$this->assertTrue( $params[0]->isOptional () == false);
|
|
}
|
|
|
|
/**
|
|
* @covers CLI::logging
|
|
* @todo Implement testlogging().
|
|
*/
|
|
public function testlogging()
|
|
{
|
|
$methods = get_class_methods($this->object);
|
|
$this->assertTrue( in_array('logging', $methods ), 'exists method logging' );
|
|
$r = new ReflectionMethod('CLI', 'logging');
|
|
$params = $r->getParameters();
|
|
$this->assertTrue( $params[0]->getName() == 'message');
|
|
$this->assertTrue( $params[0]->isArray() == false);
|
|
$this->assertTrue( $params[0]->isOptional () == false);
|
|
$this->assertTrue( $params[1]->getName() == 'filename');
|
|
$this->assertTrue( $params[1]->isArray() == false);
|
|
$this->assertTrue( $params[1]->isOptional () == true);
|
|
$this->assertTrue( $params[1]->getDefaultValue() == '');
|
|
}
|
|
|
|
}
|