UnitTesterActions.php 18 KB

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