UnitTesterActions.php 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548
  1. <?php //[STAMP] a598cdbe5601ddbe60c940fbad750d55
  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 a string starts with the given prefix.
  204. *
  205. * @param string $prefix
  206. * @param string $string
  207. * @param string $message
  208. * @see \Codeception\Module\Asserts::assertStringStartsWith()
  209. */
  210. public function assertStringStartsWith($prefix, $string, $message = null) {
  211. return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsWith', func_get_args()));
  212. }
  213. /**
  214. * [!] Method is generated. Documentation taken from corresponding module.
  215. *
  216. * Checks that a string doesn't start with the given prefix.
  217. *
  218. * @param string $prefix
  219. * @param string $string
  220. * @param string $message
  221. * @see \Codeception\Module\Asserts::assertStringStartsNotWith()
  222. */
  223. public function assertStringStartsNotWith($prefix, $string, $message = null) {
  224. return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsNotWith', func_get_args()));
  225. }
  226. /**
  227. * [!] Method is generated. Documentation taken from corresponding module.
  228. *
  229. * Checks that variable is empty.
  230. *
  231. * @param $actual
  232. * @param string $message
  233. * @see \Codeception\Module\Asserts::assertEmpty()
  234. */
  235. public function assertEmpty($actual, $message = null) {
  236. return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEmpty', func_get_args()));
  237. }
  238. /**
  239. * [!] Method is generated. Documentation taken from corresponding module.
  240. *
  241. * Checks that variable is not empty.
  242. *
  243. * @param $actual
  244. * @param string $message
  245. * @see \Codeception\Module\Asserts::assertNotEmpty()
  246. */
  247. public function assertNotEmpty($actual, $message = null) {
  248. return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEmpty', func_get_args()));
  249. }
  250. /**
  251. * [!] Method is generated. Documentation taken from corresponding module.
  252. *
  253. * Checks that variable is NULL
  254. *
  255. * @param $actual
  256. * @param string $message
  257. * @see \Codeception\Module\Asserts::assertNull()
  258. */
  259. public function assertNull($actual, $message = null) {
  260. return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNull', func_get_args()));
  261. }
  262. /**
  263. * [!] Method is generated. Documentation taken from corresponding module.
  264. *
  265. * Checks that variable is not NULL
  266. *
  267. * @param $actual
  268. * @param string $message
  269. * @see \Codeception\Module\Asserts::assertNotNull()
  270. */
  271. public function assertNotNull($actual, $message = null) {
  272. return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotNull', func_get_args()));
  273. }
  274. /**
  275. * [!] Method is generated. Documentation taken from corresponding module.
  276. *
  277. * Checks that condition is positive.
  278. *
  279. * @param $condition
  280. * @param string $message
  281. * @see \Codeception\Module\Asserts::assertTrue()
  282. */
  283. public function assertTrue($condition, $message = null) {
  284. return $this->getScenario()->runStep(new \Codeception\Step\Action('assertTrue', func_get_args()));
  285. }
  286. /**
  287. * [!] Method is generated. Documentation taken from corresponding module.
  288. *
  289. * Checks that condition is negative.
  290. *
  291. * @param $condition
  292. * @param string $message
  293. * @see \Codeception\Module\Asserts::assertFalse()
  294. */
  295. public function assertFalse($condition, $message = null) {
  296. return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args()));
  297. }
  298. /**
  299. * [!] Method is generated. Documentation taken from corresponding module.
  300. *
  301. * Checks if file exists
  302. *
  303. * @param string $filename
  304. * @param string $message
  305. * @see \Codeception\Module\Asserts::assertFileExists()
  306. */
  307. public function assertFileExists($filename, $message = null) {
  308. return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args()));
  309. }
  310. /**
  311. * [!] Method is generated. Documentation taken from corresponding module.
  312. *
  313. * Checks if file doesn't exist
  314. *
  315. * @param string $filename
  316. * @param string $message
  317. * @see \Codeception\Module\Asserts::assertFileNotExists()
  318. */
  319. public function assertFileNotExists($filename, $message = null) {
  320. return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args()));
  321. }
  322. /**
  323. * [!] Method is generated. Documentation taken from corresponding module.
  324. *
  325. * @param $expected
  326. * @param $actual
  327. * @param $description
  328. * @see \Codeception\Module\Asserts::assertGreaterOrEquals()
  329. */
  330. public function assertGreaterOrEquals($expected, $actual, $description = null) {
  331. return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args()));
  332. }
  333. /**
  334. * [!] Method is generated. Documentation taken from corresponding module.
  335. *
  336. * @param $expected
  337. * @param $actual
  338. * @param $description
  339. * @see \Codeception\Module\Asserts::assertLessOrEquals()
  340. */
  341. public function assertLessOrEquals($expected, $actual, $description = null) {
  342. return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args()));
  343. }
  344. /**
  345. * [!] Method is generated. Documentation taken from corresponding module.
  346. *
  347. * @param $actual
  348. * @param $description
  349. * @see \Codeception\Module\Asserts::assertIsEmpty()
  350. */
  351. public function assertIsEmpty($actual, $description = null) {
  352. return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args()));
  353. }
  354. /**
  355. * [!] Method is generated. Documentation taken from corresponding module.
  356. *
  357. * @param $key
  358. * @param $actual
  359. * @param $description
  360. * @see \Codeception\Module\Asserts::assertArrayHasKey()
  361. */
  362. public function assertArrayHasKey($key, $actual, $description = null) {
  363. return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args()));
  364. }
  365. /**
  366. * [!] Method is generated. Documentation taken from corresponding module.
  367. *
  368. * @param $key
  369. * @param $actual
  370. * @param $description
  371. * @see \Codeception\Module\Asserts::assertArrayNotHasKey()
  372. */
  373. public function assertArrayNotHasKey($key, $actual, $description = null) {
  374. return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args()));
  375. }
  376. /**
  377. * [!] Method is generated. Documentation taken from corresponding module.
  378. *
  379. * Checks that array contains subset.
  380. *
  381. * @param array $subset
  382. * @param array $array
  383. * @param bool $strict
  384. * @param string $message
  385. * @see \Codeception\Module\Asserts::assertArraySubset()
  386. */
  387. public function assertArraySubset($subset, $array, $strict = null, $message = null) {
  388. return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args()));
  389. }
  390. /**
  391. * [!] Method is generated. Documentation taken from corresponding module.
  392. *
  393. * @param $expectedCount
  394. * @param $actual
  395. * @param $description
  396. * @see \Codeception\Module\Asserts::assertCount()
  397. */
  398. public function assertCount($expectedCount, $actual, $description = null) {
  399. return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args()));
  400. }
  401. /**
  402. * [!] Method is generated. Documentation taken from corresponding module.
  403. *
  404. * @param $class
  405. * @param $actual
  406. * @param $description
  407. * @see \Codeception\Module\Asserts::assertInstanceOf()
  408. */
  409. public function assertInstanceOf($class, $actual, $description = null) {
  410. return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args()));
  411. }
  412. /**
  413. * [!] Method is generated. Documentation taken from corresponding module.
  414. *
  415. * @param $class
  416. * @param $actual
  417. * @param $description
  418. * @see \Codeception\Module\Asserts::assertNotInstanceOf()
  419. */
  420. public function assertNotInstanceOf($class, $actual, $description = null) {
  421. return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args()));
  422. }
  423. /**
  424. * [!] Method is generated. Documentation taken from corresponding module.
  425. *
  426. * @param $type
  427. * @param $actual
  428. * @param $description
  429. * @see \Codeception\Module\Asserts::assertInternalType()
  430. */
  431. public function assertInternalType($type, $actual, $description = null) {
  432. return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args()));
  433. }
  434. /**
  435. * [!] Method is generated. Documentation taken from corresponding module.
  436. *
  437. * Fails the test with message.
  438. *
  439. * @param $message
  440. * @see \Codeception\Module\Asserts::fail()
  441. */
  442. public function fail($message) {
  443. return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args()));
  444. }
  445. /**
  446. * [!] Method is generated. Documentation taken from corresponding module.
  447. *
  448. * Handles and checks exception called inside callback function.
  449. * Either exception class name or exception instance should be provided.
  450. *
  451. * ```php
  452. * <?php
  453. * $I->expectException(MyException::class, function() {
  454. * $this->doSomethingBad();
  455. * });
  456. *
  457. * $I->expectException(new MyException(), function() {
  458. * $this->doSomethingBad();
  459. * });
  460. * ```
  461. * If you want to check message or exception code, you can pass them with exception instance:
  462. * ```php
  463. * <?php
  464. * // will check that exception MyException is thrown with "Don't do bad things" message
  465. * $I->expectException(new MyException("Don't do bad things"), function() {
  466. * $this->doSomethingBad();
  467. * });
  468. * ```
  469. *
  470. * @param $exception string or \Exception
  471. * @param $callback
  472. * @see \Codeception\Module\Asserts::expectException()
  473. */
  474. public function expectException($exception, $callback) {
  475. return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args()));
  476. }
  477. }