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

https://bitbucket.org/ferOnti/processmaker · PHP · 267 lines · 178 code · 19 blank · 70 comment · 63 complexity · 657786a3713a40d6c4f7a88dee6e7897 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.cli.php';
  11. /**
  12. * Generated by ProcessMaker Test Unit Generator on 2012-07-12 at 22:32:32.
  13. */
  14. class classCLITest extends PHPUnit_Framework_TestCase
  15. {
  16. /**
  17. * @var CLI
  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 CLI();
  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('CLI'); $this->assertTrue( count($methods) == 13);
  42. }
  43. /**
  44. * @covers CLI::taskName
  45. * @todo Implement testtaskName().
  46. */
  47. public function testtaskName()
  48. {
  49. $methods = get_class_methods($this->object);
  50. $this->assertTrue( in_array('taskName', $methods ), 'exists method taskName' );
  51. $r = new ReflectionMethod('CLI', 'taskName');
  52. $params = $r->getParameters();
  53. $this->assertTrue( $params[0]->getName() == 'name');
  54. $this->assertTrue( $params[0]->isArray() == false);
  55. $this->assertTrue( $params[0]->isOptional () == false);
  56. }
  57. /**
  58. * @covers CLI::taskDescription
  59. * @todo Implement testtaskDescription().
  60. */
  61. public function testtaskDescription()
  62. {
  63. $methods = get_class_methods($this->object);
  64. $this->assertTrue( in_array('taskDescription', $methods ), 'exists method taskDescription' );
  65. $r = new ReflectionMethod('CLI', 'taskDescription');
  66. $params = $r->getParameters();
  67. $this->assertTrue( $params[0]->getName() == 'description');
  68. $this->assertTrue( $params[0]->isArray() == false);
  69. $this->assertTrue( $params[0]->isOptional () == false);
  70. }
  71. /**
  72. * @covers CLI::taskArg
  73. * @todo Implement testtaskArg().
  74. */
  75. public function testtaskArg()
  76. {
  77. $methods = get_class_methods($this->object);
  78. $this->assertTrue( in_array('taskArg', $methods ), 'exists method taskArg' );
  79. $r = new ReflectionMethod('CLI', 'taskArg');
  80. $params = $r->getParameters();
  81. $this->assertTrue( $params[0]->getName() == 'name');
  82. $this->assertTrue( $params[0]->isArray() == false);
  83. $this->assertTrue( $params[0]->isOptional () == false);
  84. $this->assertTrue( $params[1]->getName() == 'optional');
  85. $this->assertTrue( $params[1]->isArray() == false);
  86. $this->assertTrue( $params[1]->isOptional () == true);
  87. $this->assertTrue( $params[1]->getDefaultValue() == '1');
  88. $this->assertTrue( $params[2]->getName() == 'multiple');
  89. $this->assertTrue( $params[2]->isArray() == false);
  90. $this->assertTrue( $params[2]->isOptional () == true);
  91. $this->assertTrue( $params[2]->getDefaultValue() == '');
  92. }
  93. /**
  94. * @covers CLI::taskOpt
  95. * @todo Implement testtaskOpt().
  96. */
  97. public function testtaskOpt()
  98. {
  99. $methods = get_class_methods($this->object);
  100. $this->assertTrue( in_array('taskOpt', $methods ), 'exists method taskOpt' );
  101. $r = new ReflectionMethod('CLI', 'taskOpt');
  102. $params = $r->getParameters();
  103. $this->assertTrue( $params[0]->getName() == 'name');
  104. $this->assertTrue( $params[0]->isArray() == false);
  105. $this->assertTrue( $params[0]->isOptional () == false);
  106. $this->assertTrue( $params[1]->getName() == 'description');
  107. $this->assertTrue( $params[1]->isArray() == false);
  108. $this->assertTrue( $params[1]->isOptional () == false);
  109. $this->assertTrue( $params[2]->getName() == 'short');
  110. $this->assertTrue( $params[2]->isArray() == false);
  111. $this->assertTrue( $params[2]->isOptional () == false);
  112. $this->assertTrue( $params[3]->getName() == 'long');
  113. $this->assertTrue( $params[3]->isArray() == false);
  114. $this->assertTrue( $params[3]->isOptional () == true);
  115. $this->assertTrue( $params[3]->getDefaultValue() == '');
  116. }
  117. /**
  118. * @covers CLI::taskRun
  119. * @todo Implement testtaskRun().
  120. */
  121. public function testtaskRun()
  122. {
  123. $methods = get_class_methods($this->object);
  124. $this->assertTrue( in_array('taskRun', $methods ), 'exists method taskRun' );
  125. $r = new ReflectionMethod('CLI', 'taskRun');
  126. $params = $r->getParameters();
  127. $this->assertTrue( $params[0]->getName() == 'function');
  128. $this->assertTrue( $params[0]->isArray() == false);
  129. $this->assertTrue( $params[0]->isOptional () == false);
  130. }
  131. /**
  132. * @covers CLI::help
  133. * @todo Implement testhelp().
  134. */
  135. public function testhelp()
  136. {
  137. $methods = get_class_methods($this->object);
  138. $this->assertTrue( in_array('help', $methods ), 'exists method help' );
  139. $r = new ReflectionMethod('CLI', 'help');
  140. $params = $r->getParameters();
  141. $this->assertTrue( $params[0]->getName() == 'args');
  142. $this->assertTrue( $params[0]->isArray() == false);
  143. $this->assertTrue( $params[0]->isOptional () == false);
  144. $this->assertTrue( $params[1]->getName() == 'opts');
  145. $this->assertTrue( $params[1]->isArray() == false);
  146. $this->assertTrue( $params[1]->isOptional () == true);
  147. $this->assertTrue( $params[1]->getDefaultValue() == '');
  148. }
  149. /**
  150. * @covers CLI::run
  151. * @todo Implement testrun().
  152. */
  153. public function testrun()
  154. {
  155. $methods = get_class_methods($this->object);
  156. $this->assertTrue( in_array('run', $methods ), 'exists method run' );
  157. $r = new ReflectionMethod('CLI', 'run');
  158. $params = $r->getParameters();
  159. }
  160. /**
  161. * @covers CLI::info
  162. * @todo Implement testinfo().
  163. */
  164. public function testinfo()
  165. {
  166. $methods = get_class_methods($this->object);
  167. $this->assertTrue( in_array('info', $methods ), 'exists method info' );
  168. $r = new ReflectionMethod('CLI', 'info');
  169. $params = $r->getParameters();
  170. $this->assertTrue( $params[0]->getName() == 'message');
  171. $this->assertTrue( $params[0]->isArray() == false);
  172. $this->assertTrue( $params[0]->isOptional () == false);
  173. }
  174. /**
  175. * @covers CLI::warning
  176. * @todo Implement testwarning().
  177. */
  178. public function testwarning()
  179. {
  180. $methods = get_class_methods($this->object);
  181. $this->assertTrue( in_array('warning', $methods ), 'exists method warning' );
  182. $r = new ReflectionMethod('CLI', 'warning');
  183. $params = $r->getParameters();
  184. $this->assertTrue( $params[0]->getName() == 'message');
  185. $this->assertTrue( $params[0]->isArray() == false);
  186. $this->assertTrue( $params[0]->isOptional () == false);
  187. }
  188. /**
  189. * @covers CLI::error
  190. * @todo Implement testerror().
  191. */
  192. public function testerror()
  193. {
  194. $methods = get_class_methods($this->object);
  195. $this->assertTrue( in_array('error', $methods ), 'exists method error' );
  196. $r = new ReflectionMethod('CLI', 'error');
  197. $params = $r->getParameters();
  198. $this->assertTrue( $params[0]->getName() == 'message');
  199. $this->assertTrue( $params[0]->isArray() == false);
  200. $this->assertTrue( $params[0]->isOptional () == false);
  201. }
  202. /**
  203. * @covers CLI::prompt
  204. * @todo Implement testprompt().
  205. */
  206. public function testprompt()
  207. {
  208. $methods = get_class_methods($this->object);
  209. $this->assertTrue( in_array('prompt', $methods ), 'exists method prompt' );
  210. $r = new ReflectionMethod('CLI', 'prompt');
  211. $params = $r->getParameters();
  212. $this->assertTrue( $params[0]->getName() == 'message');
  213. $this->assertTrue( $params[0]->isArray() == false);
  214. $this->assertTrue( $params[0]->isOptional () == false);
  215. }
  216. /**
  217. * @covers CLI::question
  218. * @todo Implement testquestion().
  219. */
  220. public function testquestion()
  221. {
  222. $methods = get_class_methods($this->object);
  223. $this->assertTrue( in_array('question', $methods ), 'exists method question' );
  224. $r = new ReflectionMethod('CLI', 'question');
  225. $params = $r->getParameters();
  226. $this->assertTrue( $params[0]->getName() == 'message');
  227. $this->assertTrue( $params[0]->isArray() == false);
  228. $this->assertTrue( $params[0]->isOptional () == false);
  229. }
  230. /**
  231. * @covers CLI::logging
  232. * @todo Implement testlogging().
  233. */
  234. public function testlogging()
  235. {
  236. $methods = get_class_methods($this->object);
  237. $this->assertTrue( in_array('logging', $methods ), 'exists method logging' );
  238. $r = new ReflectionMethod('CLI', 'logging');
  239. $params = $r->getParameters();
  240. $this->assertTrue( $params[0]->getName() == 'message');
  241. $this->assertTrue( $params[0]->isArray() == false);
  242. $this->assertTrue( $params[0]->isOptional () == false);
  243. $this->assertTrue( $params[1]->getName() == 'filename');
  244. $this->assertTrue( $params[1]->isArray() == false);
  245. $this->assertTrue( $params[1]->isOptional () == true);
  246. $this->assertTrue( $params[1]->getDefaultValue() == '');
  247. }
  248. }