270 lines
12 KiB
PHP
270 lines
12 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.dates.php';
|
|
|
|
/**
|
|
* Generated by ProcessMaker Test Unit Generator on 2012-07-12 at 22:32:30.
|
|
*/
|
|
|
|
class classdatesTest extends PHPUnit_Framework_TestCase
|
|
{
|
|
/**
|
|
* @var dates
|
|
*/
|
|
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 dates();
|
|
}
|
|
|
|
/**
|
|
* 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('dates'); $this->assertTrue( count($methods) == 10);
|
|
}
|
|
|
|
/**
|
|
* @covers dates::calculateDate
|
|
* @todo Implement testcalculateDate().
|
|
*/
|
|
public function testcalculateDate()
|
|
{
|
|
$methods = get_class_methods($this->object);
|
|
$this->assertTrue( in_array('calculateDate', $methods ), 'exists method calculateDate' );
|
|
$r = new ReflectionMethod('dates', 'calculateDate');
|
|
$params = $r->getParameters();
|
|
$this->assertTrue( $params[0]->getName() == 'sInitDate');
|
|
$this->assertTrue( $params[0]->isArray() == false);
|
|
$this->assertTrue( $params[0]->isOptional () == false);
|
|
$this->assertTrue( $params[1]->getName() == 'iDuration');
|
|
$this->assertTrue( $params[1]->isArray() == false);
|
|
$this->assertTrue( $params[1]->isOptional () == false);
|
|
$this->assertTrue( $params[2]->getName() == 'sTimeUnit');
|
|
$this->assertTrue( $params[2]->isArray() == false);
|
|
$this->assertTrue( $params[2]->isOptional () == false);
|
|
$this->assertTrue( $params[3]->getName() == 'iTypeDay');
|
|
$this->assertTrue( $params[3]->isArray() == false);
|
|
$this->assertTrue( $params[3]->isOptional () == false);
|
|
$this->assertTrue( $params[4]->getName() == 'UsrUid');
|
|
$this->assertTrue( $params[4]->isArray() == false);
|
|
$this->assertTrue( $params[4]->isOptional () == true);
|
|
$this->assertTrue( $params[4]->getDefaultValue() == '');
|
|
$this->assertTrue( $params[5]->getName() == 'ProUid');
|
|
$this->assertTrue( $params[5]->isArray() == false);
|
|
$this->assertTrue( $params[5]->isOptional () == true);
|
|
$this->assertTrue( $params[5]->getDefaultValue() == '');
|
|
$this->assertTrue( $params[6]->getName() == 'TasUid');
|
|
$this->assertTrue( $params[6]->isArray() == false);
|
|
$this->assertTrue( $params[6]->isOptional () == true);
|
|
$this->assertTrue( $params[6]->getDefaultValue() == '');
|
|
}
|
|
|
|
/**
|
|
* @covers dates::calculateDate_noCalendar
|
|
* @todo Implement testcalculateDate_noCalendar().
|
|
*/
|
|
public function testcalculateDate_noCalendar()
|
|
{
|
|
$methods = get_class_methods($this->object);
|
|
$this->assertTrue( in_array('calculateDate_noCalendar', $methods ), 'exists method calculateDate_noCalendar' );
|
|
$r = new ReflectionMethod('dates', 'calculateDate_noCalendar');
|
|
$params = $r->getParameters();
|
|
$this->assertTrue( $params[0]->getName() == 'sInitDate');
|
|
$this->assertTrue( $params[0]->isArray() == false);
|
|
$this->assertTrue( $params[0]->isOptional () == false);
|
|
$this->assertTrue( $params[1]->getName() == 'iDuration');
|
|
$this->assertTrue( $params[1]->isArray() == false);
|
|
$this->assertTrue( $params[1]->isOptional () == false);
|
|
$this->assertTrue( $params[2]->getName() == 'sTimeUnit');
|
|
$this->assertTrue( $params[2]->isArray() == false);
|
|
$this->assertTrue( $params[2]->isOptional () == false);
|
|
$this->assertTrue( $params[3]->getName() == 'iTypeDay');
|
|
$this->assertTrue( $params[3]->isArray() == false);
|
|
$this->assertTrue( $params[3]->isOptional () == false);
|
|
$this->assertTrue( $params[4]->getName() == 'UsrUid');
|
|
$this->assertTrue( $params[4]->isArray() == false);
|
|
$this->assertTrue( $params[4]->isOptional () == true);
|
|
$this->assertTrue( $params[4]->getDefaultValue() == '');
|
|
$this->assertTrue( $params[5]->getName() == 'ProUid');
|
|
$this->assertTrue( $params[5]->isArray() == false);
|
|
$this->assertTrue( $params[5]->isOptional () == true);
|
|
$this->assertTrue( $params[5]->getDefaultValue() == '');
|
|
$this->assertTrue( $params[6]->getName() == 'TasUid');
|
|
$this->assertTrue( $params[6]->isArray() == false);
|
|
$this->assertTrue( $params[6]->isOptional () == true);
|
|
$this->assertTrue( $params[6]->getDefaultValue() == '');
|
|
}
|
|
|
|
/**
|
|
* @covers dates::calculateDuration
|
|
* @todo Implement testcalculateDuration().
|
|
*/
|
|
public function testcalculateDuration()
|
|
{
|
|
$methods = get_class_methods($this->object);
|
|
$this->assertTrue( in_array('calculateDuration', $methods ), 'exists method calculateDuration' );
|
|
$r = new ReflectionMethod('dates', 'calculateDuration');
|
|
$params = $r->getParameters();
|
|
$this->assertTrue( $params[0]->getName() == 'sInitDate');
|
|
$this->assertTrue( $params[0]->isArray() == false);
|
|
$this->assertTrue( $params[0]->isOptional () == false);
|
|
$this->assertTrue( $params[1]->getName() == 'sEndDate');
|
|
$this->assertTrue( $params[1]->isArray() == false);
|
|
$this->assertTrue( $params[1]->isOptional () == true);
|
|
$this->assertTrue( $params[1]->getDefaultValue() == '');
|
|
$this->assertTrue( $params[2]->getName() == 'UsrUid');
|
|
$this->assertTrue( $params[2]->isArray() == false);
|
|
$this->assertTrue( $params[2]->isOptional () == true);
|
|
$this->assertTrue( $params[2]->getDefaultValue() == '');
|
|
$this->assertTrue( $params[3]->getName() == 'ProUid');
|
|
$this->assertTrue( $params[3]->isArray() == false);
|
|
$this->assertTrue( $params[3]->isOptional () == true);
|
|
$this->assertTrue( $params[3]->getDefaultValue() == '');
|
|
$this->assertTrue( $params[4]->getName() == 'TasUid');
|
|
$this->assertTrue( $params[4]->isArray() == false);
|
|
$this->assertTrue( $params[4]->isOptional () == true);
|
|
$this->assertTrue( $params[4]->getDefaultValue() == '');
|
|
}
|
|
|
|
/**
|
|
* @covers dates::prepareInformation
|
|
* @todo Implement testprepareInformation().
|
|
*/
|
|
public function testprepareInformation()
|
|
{
|
|
$methods = get_class_methods($this->object);
|
|
$this->assertTrue( in_array('prepareInformation', $methods ), 'exists method prepareInformation' );
|
|
$r = new ReflectionMethod('dates', 'prepareInformation');
|
|
$params = $r->getParameters();
|
|
$this->assertTrue( $params[0]->getName() == 'UsrUid');
|
|
$this->assertTrue( $params[0]->isArray() == false);
|
|
$this->assertTrue( $params[0]->isOptional () == true);
|
|
$this->assertTrue( $params[0]->getDefaultValue() == '');
|
|
$this->assertTrue( $params[1]->getName() == 'ProUid');
|
|
$this->assertTrue( $params[1]->isArray() == false);
|
|
$this->assertTrue( $params[1]->isOptional () == true);
|
|
$this->assertTrue( $params[1]->getDefaultValue() == '');
|
|
$this->assertTrue( $params[2]->getName() == 'TasUid');
|
|
$this->assertTrue( $params[2]->isArray() == false);
|
|
$this->assertTrue( $params[2]->isOptional () == true);
|
|
$this->assertTrue( $params[2]->getDefaultValue() == '');
|
|
}
|
|
|
|
/**
|
|
* @covers dates::setSkipEveryYear
|
|
* @todo Implement testsetSkipEveryYear().
|
|
*/
|
|
public function testsetSkipEveryYear()
|
|
{
|
|
$methods = get_class_methods($this->object);
|
|
$this->assertTrue( in_array('setSkipEveryYear', $methods ), 'exists method setSkipEveryYear' );
|
|
$r = new ReflectionMethod('dates', 'setSkipEveryYear');
|
|
$params = $r->getParameters();
|
|
$this->assertTrue( $params[0]->getName() == 'bSkipEveryYear');
|
|
$this->assertTrue( $params[0]->isArray() == false);
|
|
$this->assertTrue( $params[0]->isOptional () == false);
|
|
}
|
|
|
|
/**
|
|
* @covers dates::addHoliday
|
|
* @todo Implement testaddHoliday().
|
|
*/
|
|
public function testaddHoliday()
|
|
{
|
|
$methods = get_class_methods($this->object);
|
|
$this->assertTrue( in_array('addHoliday', $methods ), 'exists method addHoliday' );
|
|
$r = new ReflectionMethod('dates', 'addHoliday');
|
|
$params = $r->getParameters();
|
|
$this->assertTrue( $params[0]->getName() == 'sDate');
|
|
$this->assertTrue( $params[0]->isArray() == false);
|
|
$this->assertTrue( $params[0]->isOptional () == false);
|
|
}
|
|
|
|
/**
|
|
* @covers dates::setHolidays
|
|
* @todo Implement testsetHolidays().
|
|
*/
|
|
public function testsetHolidays()
|
|
{
|
|
$methods = get_class_methods($this->object);
|
|
$this->assertTrue( in_array('setHolidays', $methods ), 'exists method setHolidays' );
|
|
$r = new ReflectionMethod('dates', 'setHolidays');
|
|
$params = $r->getParameters();
|
|
$this->assertTrue( $params[0]->getName() == 'aDates');
|
|
$this->assertTrue( $params[0]->isArray() == false);
|
|
$this->assertTrue( $params[0]->isOptional () == false);
|
|
}
|
|
|
|
/**
|
|
* @covers dates::setWeekends
|
|
* @todo Implement testsetWeekends().
|
|
*/
|
|
public function testsetWeekends()
|
|
{
|
|
$methods = get_class_methods($this->object);
|
|
$this->assertTrue( in_array('setWeekends', $methods ), 'exists method setWeekends' );
|
|
$r = new ReflectionMethod('dates', 'setWeekends');
|
|
$params = $r->getParameters();
|
|
$this->assertTrue( $params[0]->getName() == 'aWeekends');
|
|
$this->assertTrue( $params[0]->isArray() == false);
|
|
$this->assertTrue( $params[0]->isOptional () == false);
|
|
}
|
|
|
|
/**
|
|
* @covers dates::skipDayOfWeek
|
|
* @todo Implement testskipDayOfWeek().
|
|
*/
|
|
public function testskipDayOfWeek()
|
|
{
|
|
$methods = get_class_methods($this->object);
|
|
$this->assertTrue( in_array('skipDayOfWeek', $methods ), 'exists method skipDayOfWeek' );
|
|
$r = new ReflectionMethod('dates', 'skipDayOfWeek');
|
|
$params = $r->getParameters();
|
|
$this->assertTrue( $params[0]->getName() == 'iDayNumber');
|
|
$this->assertTrue( $params[0]->isArray() == false);
|
|
$this->assertTrue( $params[0]->isOptional () == false);
|
|
}
|
|
|
|
/**
|
|
* @covers dates::addNonWorkingRange
|
|
* @todo Implement testaddNonWorkingRange().
|
|
*/
|
|
public function testaddNonWorkingRange()
|
|
{
|
|
$methods = get_class_methods($this->object);
|
|
$this->assertTrue( in_array('addNonWorkingRange', $methods ), 'exists method addNonWorkingRange' );
|
|
$r = new ReflectionMethod('dates', 'addNonWorkingRange');
|
|
$params = $r->getParameters();
|
|
$this->assertTrue( $params[0]->getName() == 'sDateA');
|
|
$this->assertTrue( $params[0]->isArray() == false);
|
|
$this->assertTrue( $params[0]->isOptional () == false);
|
|
$this->assertTrue( $params[1]->getName() == 'sDateB');
|
|
$this->assertTrue( $params[1]->isArray() == false);
|
|
$this->assertTrue( $params[1]->isOptional () == false);
|
|
}
|
|
|
|
}
|