PageRenderTime 75ms CodeModel.GetById 23ms RepoModel.GetById 1ms app.codeStats 0ms

/tests/automated/workflow/engine/classes/classdatesTest.php

https://bitbucket.org/ferOnti/processmaker
PHP | 269 lines | 195 code | 16 blank | 58 comment | 101 complexity | dc8ca1ac860ecb74a040174a404601ca MD5 | raw file
  1. <?php
  2. require_once PATH_TRUNK . 'gulliver/thirdparty/smarty/libs/Smarty.class.php';
  3. require_once PATH_TRUNK . 'gulliver/system/class.xmlform.php';
  4. require_once PATH_TRUNK . 'gulliver/system/class.xmlDocument.php';
  5. require_once PATH_TRUNK . 'gulliver/system/class.form.php';
  6. require_once PATH_TRUNK . 'gulliver/system/class.dbconnection.php';
  7. require_once PATH_TRUNK . 'gulliver/thirdparty/propel/Propel.php';
  8. require_once PATH_TRUNK . 'gulliver/thirdparty/creole/Creole.php';
  9. require_once PATH_TRUNK . 'gulliver/thirdparty/pear/PEAR.php';
  10. require_once PATH_TRUNK . 'workflow/engine/classes/class.dates.php';
  11. /**
  12. * Generated by ProcessMaker Test Unit Generator on 2012-07-12 at 22:32:30.
  13. */
  14. class classdatesTest extends PHPUnit_Framework_TestCase
  15. {
  16. /**
  17. * @var dates
  18. */
  19. protected $object;
  20. /**
  21. * Sets up the fixture, for example, opens a network connection.
  22. * This method is called before a test is executed.
  23. */
  24. protected function setUp()
  25. {
  26. $this->object = new dates();
  27. }
  28. /**
  29. * Tears down the fixture, for example, closes a network connection.
  30. * This method is called after a test is executed.
  31. */
  32. protected function tearDown()
  33. {
  34. }
  35. /**
  36. * This is the default method to test, if the class still having
  37. * the same number of methods.
  38. */
  39. public function testNumberOfMethodsInThisClass()
  40. {
  41. $methods = get_class_methods('dates'); $this->assertTrue( count($methods) == 10);
  42. }
  43. /**
  44. * @covers dates::calculateDate
  45. * @todo Implement testcalculateDate().
  46. */
  47. public function testcalculateDate()
  48. {
  49. $methods = get_class_methods($this->object);
  50. $this->assertTrue( in_array('calculateDate', $methods ), 'exists method calculateDate' );
  51. $r = new ReflectionMethod('dates', 'calculateDate');
  52. $params = $r->getParameters();
  53. $this->assertTrue( $params[0]->getName() == 'sInitDate');
  54. $this->assertTrue( $params[0]->isArray() == false);
  55. $this->assertTrue( $params[0]->isOptional () == false);
  56. $this->assertTrue( $params[1]->getName() == 'iDuration');
  57. $this->assertTrue( $params[1]->isArray() == false);
  58. $this->assertTrue( $params[1]->isOptional () == false);
  59. $this->assertTrue( $params[2]->getName() == 'sTimeUnit');
  60. $this->assertTrue( $params[2]->isArray() == false);
  61. $this->assertTrue( $params[2]->isOptional () == false);
  62. $this->assertTrue( $params[3]->getName() == 'iTypeDay');
  63. $this->assertTrue( $params[3]->isArray() == false);
  64. $this->assertTrue( $params[3]->isOptional () == false);
  65. $this->assertTrue( $params[4]->getName() == 'UsrUid');
  66. $this->assertTrue( $params[4]->isArray() == false);
  67. $this->assertTrue( $params[4]->isOptional () == true);
  68. $this->assertTrue( $params[4]->getDefaultValue() == '');
  69. $this->assertTrue( $params[5]->getName() == 'ProUid');
  70. $this->assertTrue( $params[5]->isArray() == false);
  71. $this->assertTrue( $params[5]->isOptional () == true);
  72. $this->assertTrue( $params[5]->getDefaultValue() == '');
  73. $this->assertTrue( $params[6]->getName() == 'TasUid');
  74. $this->assertTrue( $params[6]->isArray() == false);
  75. $this->assertTrue( $params[6]->isOptional () == true);
  76. $this->assertTrue( $params[6]->getDefaultValue() == '');
  77. }
  78. /**
  79. * @covers dates::calculateDate_noCalendar
  80. * @todo Implement testcalculateDate_noCalendar().
  81. */
  82. public function testcalculateDate_noCalendar()
  83. {
  84. $methods = get_class_methods($this->object);
  85. $this->assertTrue( in_array('calculateDate_noCalendar', $methods ), 'exists method calculateDate_noCalendar' );
  86. $r = new ReflectionMethod('dates', 'calculateDate_noCalendar');
  87. $params = $r->getParameters();
  88. $this->assertTrue( $params[0]->getName() == 'sInitDate');
  89. $this->assertTrue( $params[0]->isArray() == false);
  90. $this->assertTrue( $params[0]->isOptional () == false);
  91. $this->assertTrue( $params[1]->getName() == 'iDuration');
  92. $this->assertTrue( $params[1]->isArray() == false);
  93. $this->assertTrue( $params[1]->isOptional () == false);
  94. $this->assertTrue( $params[2]->getName() == 'sTimeUnit');
  95. $this->assertTrue( $params[2]->isArray() == false);
  96. $this->assertTrue( $params[2]->isOptional () == false);
  97. $this->assertTrue( $params[3]->getName() == 'iTypeDay');
  98. $this->assertTrue( $params[3]->isArray() == false);
  99. $this->assertTrue( $params[3]->isOptional () == false);
  100. $this->assertTrue( $params[4]->getName() == 'UsrUid');
  101. $this->assertTrue( $params[4]->isArray() == false);
  102. $this->assertTrue( $params[4]->isOptional () == true);
  103. $this->assertTrue( $params[4]->getDefaultValue() == '');
  104. $this->assertTrue( $params[5]->getName() == 'ProUid');
  105. $this->assertTrue( $params[5]->isArray() == false);
  106. $this->assertTrue( $params[5]->isOptional () == true);
  107. $this->assertTrue( $params[5]->getDefaultValue() == '');
  108. $this->assertTrue( $params[6]->getName() == 'TasUid');
  109. $this->assertTrue( $params[6]->isArray() == false);
  110. $this->assertTrue( $params[6]->isOptional () == true);
  111. $this->assertTrue( $params[6]->getDefaultValue() == '');
  112. }
  113. /**
  114. * @covers dates::calculateDuration
  115. * @todo Implement testcalculateDuration().
  116. */
  117. public function testcalculateDuration()
  118. {
  119. $methods = get_class_methods($this->object);
  120. $this->assertTrue( in_array('calculateDuration', $methods ), 'exists method calculateDuration' );
  121. $r = new ReflectionMethod('dates', 'calculateDuration');
  122. $params = $r->getParameters();
  123. $this->assertTrue( $params[0]->getName() == 'sInitDate');
  124. $this->assertTrue( $params[0]->isArray() == false);
  125. $this->assertTrue( $params[0]->isOptional () == false);
  126. $this->assertTrue( $params[1]->getName() == 'sEndDate');
  127. $this->assertTrue( $params[1]->isArray() == false);
  128. $this->assertTrue( $params[1]->isOptional () == true);
  129. $this->assertTrue( $params[1]->getDefaultValue() == '');
  130. $this->assertTrue( $params[2]->getName() == 'UsrUid');
  131. $this->assertTrue( $params[2]->isArray() == false);
  132. $this->assertTrue( $params[2]->isOptional () == true);
  133. $this->assertTrue( $params[2]->getDefaultValue() == '');
  134. $this->assertTrue( $params[3]->getName() == 'ProUid');
  135. $this->assertTrue( $params[3]->isArray() == false);
  136. $this->assertTrue( $params[3]->isOptional () == true);
  137. $this->assertTrue( $params[3]->getDefaultValue() == '');
  138. $this->assertTrue( $params[4]->getName() == 'TasUid');
  139. $this->assertTrue( $params[4]->isArray() == false);
  140. $this->assertTrue( $params[4]->isOptional () == true);
  141. $this->assertTrue( $params[4]->getDefaultValue() == '');
  142. }
  143. /**
  144. * @covers dates::prepareInformation
  145. * @todo Implement testprepareInformation().
  146. */
  147. public function testprepareInformation()
  148. {
  149. $methods = get_class_methods($this->object);
  150. $this->assertTrue( in_array('prepareInformation', $methods ), 'exists method prepareInformation' );
  151. $r = new ReflectionMethod('dates', 'prepareInformation');
  152. $params = $r->getParameters();
  153. $this->assertTrue( $params[0]->getName() == 'UsrUid');
  154. $this->assertTrue( $params[0]->isArray() == false);
  155. $this->assertTrue( $params[0]->isOptional () == true);
  156. $this->assertTrue( $params[0]->getDefaultValue() == '');
  157. $this->assertTrue( $params[1]->getName() == 'ProUid');
  158. $this->assertTrue( $params[1]->isArray() == false);
  159. $this->assertTrue( $params[1]->isOptional () == true);
  160. $this->assertTrue( $params[1]->getDefaultValue() == '');
  161. $this->assertTrue( $params[2]->getName() == 'TasUid');
  162. $this->assertTrue( $params[2]->isArray() == false);
  163. $this->assertTrue( $params[2]->isOptional () == true);
  164. $this->assertTrue( $params[2]->getDefaultValue() == '');
  165. }
  166. /**
  167. * @covers dates::setSkipEveryYear
  168. * @todo Implement testsetSkipEveryYear().
  169. */
  170. public function testsetSkipEveryYear()
  171. {
  172. $methods = get_class_methods($this->object);
  173. $this->assertTrue( in_array('setSkipEveryYear', $methods ), 'exists method setSkipEveryYear' );
  174. $r = new ReflectionMethod('dates', 'setSkipEveryYear');
  175. $params = $r->getParameters();
  176. $this->assertTrue( $params[0]->getName() == 'bSkipEveryYear');
  177. $this->assertTrue( $params[0]->isArray() == false);
  178. $this->assertTrue( $params[0]->isOptional () == false);
  179. }
  180. /**
  181. * @covers dates::addHoliday
  182. * @todo Implement testaddHoliday().
  183. */
  184. public function testaddHoliday()
  185. {
  186. $methods = get_class_methods($this->object);
  187. $this->assertTrue( in_array('addHoliday', $methods ), 'exists method addHoliday' );
  188. $r = new ReflectionMethod('dates', 'addHoliday');
  189. $params = $r->getParameters();
  190. $this->assertTrue( $params[0]->getName() == 'sDate');
  191. $this->assertTrue( $params[0]->isArray() == false);
  192. $this->assertTrue( $params[0]->isOptional () == false);
  193. }
  194. /**
  195. * @covers dates::setHolidays
  196. * @todo Implement testsetHolidays().
  197. */
  198. public function testsetHolidays()
  199. {
  200. $methods = get_class_methods($this->object);
  201. $this->assertTrue( in_array('setHolidays', $methods ), 'exists method setHolidays' );
  202. $r = new ReflectionMethod('dates', 'setHolidays');
  203. $params = $r->getParameters();
  204. $this->assertTrue( $params[0]->getName() == 'aDates');
  205. $this->assertTrue( $params[0]->isArray() == false);
  206. $this->assertTrue( $params[0]->isOptional () == false);
  207. }
  208. /**
  209. * @covers dates::setWeekends
  210. * @todo Implement testsetWeekends().
  211. */
  212. public function testsetWeekends()
  213. {
  214. $methods = get_class_methods($this->object);
  215. $this->assertTrue( in_array('setWeekends', $methods ), 'exists method setWeekends' );
  216. $r = new ReflectionMethod('dates', 'setWeekends');
  217. $params = $r->getParameters();
  218. $this->assertTrue( $params[0]->getName() == 'aWeekends');
  219. $this->assertTrue( $params[0]->isArray() == false);
  220. $this->assertTrue( $params[0]->isOptional () == false);
  221. }
  222. /**
  223. * @covers dates::skipDayOfWeek
  224. * @todo Implement testskipDayOfWeek().
  225. */
  226. public function testskipDayOfWeek()
  227. {
  228. $methods = get_class_methods($this->object);
  229. $this->assertTrue( in_array('skipDayOfWeek', $methods ), 'exists method skipDayOfWeek' );
  230. $r = new ReflectionMethod('dates', 'skipDayOfWeek');
  231. $params = $r->getParameters();
  232. $this->assertTrue( $params[0]->getName() == 'iDayNumber');
  233. $this->assertTrue( $params[0]->isArray() == false);
  234. $this->assertTrue( $params[0]->isOptional () == false);
  235. }
  236. /**
  237. * @covers dates::addNonWorkingRange
  238. * @todo Implement testaddNonWorkingRange().
  239. */
  240. public function testaddNonWorkingRange()
  241. {
  242. $methods = get_class_methods($this->object);
  243. $this->assertTrue( in_array('addNonWorkingRange', $methods ), 'exists method addNonWorkingRange' );
  244. $r = new ReflectionMethod('dates', 'addNonWorkingRange');
  245. $params = $r->getParameters();
  246. $this->assertTrue( $params[0]->getName() == 'sDateA');
  247. $this->assertTrue( $params[0]->isArray() == false);
  248. $this->assertTrue( $params[0]->isOptional () == false);
  249. $this->assertTrue( $params[1]->getName() == 'sDateB');
  250. $this->assertTrue( $params[1]->isArray() == false);
  251. $this->assertTrue( $params[1]->isOptional () == false);
  252. }
  253. }