UnitTesterActions.php 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502
  1. <?php //[STAMP] f70ebbe2fe34ed5c20c33b65fb3a7753
  2. namespace _generated;
  3. // This class was automatically generated by build task
  4. // You should not change it manually as it will be overwritten on next build
  5. // @codingStandardsIgnoreFile
  6. use Codeception\Module\Asserts;
  7. use Helper\Unit;
  8. trait UnitTesterActions
  9. {
  10. /**
  11. * @return \Codeception\Scenario
  12. */
  13. abstract protected function getScenario();
  14. /**
  15. * [!] Method is generated. Documentation taken from corresponding module.
  16. *
  17. * Checks that two variables are equal. If you're comparing floating-point values,
  18. * you can specify the optional "delta" parameter which dictates how great of a precision
  19. * error are you willing to tolerate in order to consider the two values equal.
  20. *
  21. * Regular example:
  22. * ```php
  23. * <?php
  24. * $I->assertEquals($element->getChildrenCount(), 5);
  25. * ```
  26. *
  27. * Floating-point example:
  28. * ```php
  29. * <?php
  30. * $I->assertEquals($calculator->add(0.1, 0.2), 0.3, 'Calculator should add the two numbers correctly.', 0.01);
  31. * ```
  32. *
  33. * @param $expected
  34. * @param $actual
  35. * @param string $message
  36. * @param float $delta
  37. * @see \Codeception\Module\Asserts::assertEquals()
  38. */
  39. public function assertEquals($expected, $actual, $message = null, $delta = null) {
  40. return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEquals', func_get_args()));
  41. }
  42. /**
  43. * [!] Method is generated. Documentation taken from corresponding module.
  44. *
  45. * Checks that two variables are not equal. If you're comparing floating-point values,
  46. * you can specify the optional "delta" parameter which dictates how great of a precision
  47. * error are you willing to tolerate in order to consider the two values not equal.
  48. *
  49. * Regular example:
  50. * ```php
  51. * <?php
  52. * $I->assertNotEquals($element->getChildrenCount(), 0);
  53. * ```
  54. *
  55. * Floating-point example:
  56. * ```php
  57. * <?php
  58. * $I->assertNotEquals($calculator->add(0.1, 0.2), 0.4, 'Calculator should add the two numbers correctly.', 0.01);
  59. * ```
  60. *
  61. * @param $expected
  62. * @param $actual
  63. * @param string $message
  64. * @param float $delta
  65. * @see \Codeception\Module\Asserts::assertNotEquals()
  66. */
  67. public function assertNotEquals($expected, $actual, $message = null, $delta = null) {
  68. return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEquals', func_get_args()));
  69. }
  70. /**
  71. * [!] Method is generated. Documentation taken from corresponding module.
  72. *
  73. * Checks that two variables are same
  74. *
  75. * @param $expected
  76. * @param $actual
  77. * @param string $message
  78. * @see \Codeception\Module\Asserts::assertSame()
  79. */
  80. public function assertSame($expected, $actual, $message = null) {
  81. return $this->getScenario()->runStep(new \Codeception\Step\Action('assertSame', func_get_args()));
  82. }
  83. /**
  84. * [!] Method is generated. Documentation taken from corresponding module.
  85. *
  86. * Checks that two variables are not same
  87. *
  88. * @param $expected
  89. * @param $actual
  90. * @param string $message
  91. * @see \Codeception\Module\Asserts::assertNotSame()
  92. */
  93. public function assertNotSame($expected, $actual, $message = null) {
  94. return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotSame', func_get_args()));
  95. }
  96. /**
  97. * [!] Method is generated. Documentation taken from corresponding module.
  98. *
  99. * Checks that actual is greater than expected
  100. *
  101. * @param $expected
  102. * @param $actual
  103. * @param string $message
  104. * @see \Codeception\Module\Asserts::assertGreaterThan()
  105. */
  106. public function assertGreaterThan($expected, $actual, $message = null) {
  107. return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThan', func_get_args()));
  108. }
  109. /**
  110. * [!] Method is generated. Documentation taken from corresponding module.
  111. *
  112. * Checks that actual is greater or equal than expected
  113. *
  114. * @param $expected
  115. * @param $actual
  116. * @param string $message
  117. * @see \Codeception\Module\Asserts::assertGreaterThanOrEqual()
  118. */
  119. public function assertGreaterThanOrEqual($expected, $actual, $message = null) {
  120. return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThanOrEqual', func_get_args()));
  121. }
  122. /**
  123. * [!] Method is generated. Documentation taken from corresponding module.
  124. *
  125. * Checks that actual is less than expected
  126. *
  127. * @param $expected
  128. * @param $actual
  129. * @param string $message
  130. * @see \Codeception\Module\Asserts::assertLessThan()
  131. */
  132. public function assertLessThan($expected, $actual, $message = null) {
  133. return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThan', func_get_args()));
  134. }
  135. /**
  136. * [!] Method is generated. Documentation taken from corresponding module.
  137. *
  138. * Checks that actual is less or equal than expected
  139. *
  140. * @param $expected
  141. * @param $actual
  142. * @param string $message
  143. * @see \Codeception\Module\Asserts::assertLessThanOrEqual()
  144. */
  145. public function assertLessThanOrEqual($expected, $actual, $message = null) {
  146. return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThanOrEqual', func_get_args()));
  147. }
  148. /**
  149. * [!] Method is generated. Documentation taken from corresponding module.
  150. *
  151. * Checks that haystack contains needle
  152. *
  153. * @param $needle
  154. * @param $haystack
  155. * @param string $message
  156. * @see \Codeception\Module\Asserts::assertContains()
  157. */
  158. public function assertContains($needle, $haystack, $message = null) {
  159. return $this->getScenario()->runStep(new \Codeception\Step\Action('assertContains', func_get_args()));
  160. }
  161. /**
  162. * [!] Method is generated. Documentation taken from corresponding module.
  163. *
  164. * Checks that haystack doesn't contain needle.
  165. *
  166. * @param $needle
  167. * @param $haystack
  168. * @param string $message
  169. * @see \Codeception\Module\Asserts::assertNotContains()
  170. */
  171. public function assertNotContains($needle, $haystack, $message = null) {
  172. return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotContains', func_get_args()));
  173. }
  174. /**
  175. * [!] Method is generated. Documentation taken from corresponding module.
  176. *
  177. * Checks that string match with pattern
  178. *
  179. * @param string $pattern
  180. * @param string $string
  181. * @param string $message
  182. * @see \Codeception\Module\Asserts::assertRegExp()
  183. */
  184. public function assertRegExp($pattern, $string, $message = null) {
  185. return $this->getScenario()->runStep(new \Codeception\Step\Action('assertRegExp', func_get_args()));
  186. }
  187. /**
  188. * [!] Method is generated. Documentation taken from corresponding module.
  189. *
  190. * Checks that string not match with pattern
  191. *
  192. * @param string $pattern
  193. * @param string $string
  194. * @param string $message
  195. * @see \Codeception\Module\Asserts::assertNotRegExp()
  196. */
  197. public function assertNotRegExp($pattern, $string, $message = null) {
  198. return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotRegExp', func_get_args()));
  199. }
  200. /**
  201. * [!] Method is generated. Documentation taken from corresponding module.
  202. *
  203. * Checks that variable is empty.
  204. *
  205. * @param $actual
  206. * @param string $message
  207. * @see \Codeception\Module\Asserts::assertEmpty()
  208. */
  209. public function assertEmpty($actual, $message = null) {
  210. return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEmpty', func_get_args()));
  211. }
  212. /**
  213. * [!] Method is generated. Documentation taken from corresponding module.
  214. *
  215. * Checks that variable is not empty.
  216. *
  217. * @param $actual
  218. * @param string $message
  219. * @see \Codeception\Module\Asserts::assertNotEmpty()
  220. */
  221. public function assertNotEmpty($actual, $message = null) {
  222. return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEmpty', func_get_args()));
  223. }
  224. /**
  225. * [!] Method is generated. Documentation taken from corresponding module.
  226. *
  227. * Checks that variable is NULL
  228. *
  229. * @param $actual
  230. * @param string $message
  231. * @see \Codeception\Module\Asserts::assertNull()
  232. */
  233. public function assertNull($actual, $message = null) {
  234. return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNull', func_get_args()));
  235. }
  236. /**
  237. * [!] Method is generated. Documentation taken from corresponding module.
  238. *
  239. * Checks that variable is not NULL
  240. *
  241. * @param $actual
  242. * @param string $message
  243. * @see \Codeception\Module\Asserts::assertNotNull()
  244. */
  245. public function assertNotNull($actual, $message = null) {
  246. return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotNull', func_get_args()));
  247. }
  248. /**
  249. * [!] Method is generated. Documentation taken from corresponding module.
  250. *
  251. * Checks that condition is positive.
  252. *
  253. * @param $condition
  254. * @param string $message
  255. * @see \Codeception\Module\Asserts::assertTrue()
  256. */
  257. public function assertTrue($condition, $message = null) {
  258. return $this->getScenario()->runStep(new \Codeception\Step\Action('assertTrue', func_get_args()));
  259. }
  260. /**
  261. * [!] Method is generated. Documentation taken from corresponding module.
  262. *
  263. * Checks that condition is negative.
  264. *
  265. * @param $condition
  266. * @param string $message
  267. * @see \Codeception\Module\Asserts::assertFalse()
  268. */
  269. public function assertFalse($condition, $message = null) {
  270. return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args()));
  271. }
  272. /**
  273. * [!] Method is generated. Documentation taken from corresponding module.
  274. *
  275. * Checks if file exists
  276. *
  277. * @param string $filename
  278. * @param string $message
  279. * @see \Codeception\Module\Asserts::assertFileExists()
  280. */
  281. public function assertFileExists($filename, $message = null) {
  282. return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args()));
  283. }
  284. /**
  285. * [!] Method is generated. Documentation taken from corresponding module.
  286. *
  287. * Checks if file doesn't exist
  288. *
  289. * @param string $filename
  290. * @param string $message
  291. * @see \Codeception\Module\Asserts::assertFileNotExists()
  292. */
  293. public function assertFileNotExists($filename, $message = null) {
  294. return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args()));
  295. }
  296. /**
  297. * [!] Method is generated. Documentation taken from corresponding module.
  298. *
  299. * @param $expected
  300. * @param $actual
  301. * @param $description
  302. * @see \Codeception\Module\Asserts::assertGreaterOrEquals()
  303. */
  304. public function assertGreaterOrEquals($expected, $actual, $description = null) {
  305. return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args()));
  306. }
  307. /**
  308. * [!] Method is generated. Documentation taken from corresponding module.
  309. *
  310. * @param $expected
  311. * @param $actual
  312. * @param $description
  313. * @see \Codeception\Module\Asserts::assertLessOrEquals()
  314. */
  315. public function assertLessOrEquals($expected, $actual, $description = null) {
  316. return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args()));
  317. }
  318. /**
  319. * [!] Method is generated. Documentation taken from corresponding module.
  320. *
  321. * @param $actual
  322. * @param $description
  323. * @see \Codeception\Module\Asserts::assertIsEmpty()
  324. */
  325. public function assertIsEmpty($actual, $description = null) {
  326. return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args()));
  327. }
  328. /**
  329. * [!] Method is generated. Documentation taken from corresponding module.
  330. *
  331. * @param $key
  332. * @param $actual
  333. * @param $description
  334. * @see \Codeception\Module\Asserts::assertArrayHasKey()
  335. */
  336. public function assertArrayHasKey($key, $actual, $description = null) {
  337. return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args()));
  338. }
  339. /**
  340. * [!] Method is generated. Documentation taken from corresponding module.
  341. *
  342. * @param $key
  343. * @param $actual
  344. * @param $description
  345. * @see \Codeception\Module\Asserts::assertArrayNotHasKey()
  346. */
  347. public function assertArrayNotHasKey($key, $actual, $description = null) {
  348. return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args()));
  349. }
  350. /**
  351. * [!] Method is generated. Documentation taken from corresponding module.
  352. *
  353. * @param $expectedCount
  354. * @param $actual
  355. * @param $description
  356. * @see \Codeception\Module\Asserts::assertCount()
  357. */
  358. public function assertCount($expectedCount, $actual, $description = null) {
  359. return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args()));
  360. }
  361. /**
  362. * [!] Method is generated. Documentation taken from corresponding module.
  363. *
  364. * @param $class
  365. * @param $actual
  366. * @param $description
  367. * @see \Codeception\Module\Asserts::assertInstanceOf()
  368. */
  369. public function assertInstanceOf($class, $actual, $description = null) {
  370. return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args()));
  371. }
  372. /**
  373. * [!] Method is generated. Documentation taken from corresponding module.
  374. *
  375. * @param $class
  376. * @param $actual
  377. * @param $description
  378. * @see \Codeception\Module\Asserts::assertNotInstanceOf()
  379. */
  380. public function assertNotInstanceOf($class, $actual, $description = null) {
  381. return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args()));
  382. }
  383. /**
  384. * [!] Method is generated. Documentation taken from corresponding module.
  385. *
  386. * @param $type
  387. * @param $actual
  388. * @param $description
  389. * @see \Codeception\Module\Asserts::assertInternalType()
  390. */
  391. public function assertInternalType($type, $actual, $description = null) {
  392. return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args()));
  393. }
  394. /**
  395. * [!] Method is generated. Documentation taken from corresponding module.
  396. *
  397. * Fails the test with message.
  398. *
  399. * @param $message
  400. * @see \Codeception\Module\Asserts::fail()
  401. */
  402. public function fail($message) {
  403. return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args()));
  404. }
  405. /**
  406. * [!] Method is generated. Documentation taken from corresponding module.
  407. *
  408. * Handles and checks exception called inside callback function.
  409. * Either exception class name or exception instance should be provided.
  410. *
  411. * ```php
  412. * <?php
  413. * $I->expectException(MyException::class, function() {
  414. * $this->doSomethingBad();
  415. * });
  416. *
  417. * $I->expectException(new MyException(), function() {
  418. * $this->doSomethingBad();
  419. * });
  420. * ```
  421. * If you want to check message or exception code, you can pass them with exception instance:
  422. * ```php
  423. * <?php
  424. * // will check that exception MyException is thrown with "Don't do bad things" message
  425. * $I->expectException(new MyException("Don't do bad things"), function() {
  426. * $this->doSomethingBad();
  427. * });
  428. * ```
  429. *
  430. * @param $exception string or \Exception
  431. * @param $callback
  432. * @see \Codeception\Module\Asserts::expectException()
  433. */
  434. public function expectException($exception, $callback) {
  435. return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args()));
  436. }
  437. }