UnitTesterActions.php 18 KB

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