@@ -402,6 +402,9 @@ discard block |
||
402 | 402 | return $lastInsertId; |
403 | 403 | } |
404 | 404 | |
405 | + /** |
|
406 | + * @param string $table |
|
407 | + */ |
|
405 | 408 | public function _insertInDatabase($table, array $data) |
406 | 409 | { |
407 | 410 | $query = $this->driver->insert($table, $data); |
@@ -420,6 +423,10 @@ discard block |
||
420 | 423 | return $lastInsertId; |
421 | 424 | } |
422 | 425 | |
426 | + /** |
|
427 | + * @param string $table |
|
428 | + * @param integer $id |
|
429 | + */ |
|
423 | 430 | private function addInsertedRow($table, array $row, $id) |
424 | 431 | { |
425 | 432 | $primaryKey = $this->driver->getPrimaryKey($table); |
@@ -510,6 +517,10 @@ discard block |
||
510 | 517 | return (int) $this->proceedSeeInDatabase($table, 'count(*)', $criteria); |
511 | 518 | } |
512 | 519 | |
520 | + /** |
|
521 | + * @param string $table |
|
522 | + * @param string $column |
|
523 | + */ |
|
513 | 524 | protected function proceedSeeInDatabase($table, $column, $criteria) |
514 | 525 | { |
515 | 526 | $query = $this->driver->select($column, $table, $criteria); |
@@ -85,6 +85,9 @@ |
||
85 | 85 | return true; |
86 | 86 | } |
87 | 87 | |
88 | + /** |
|
89 | + * @param string $query |
|
90 | + */ |
|
88 | 91 | public function sqlQuery($query) |
89 | 92 | { |
90 | 93 | if (strpos(trim($query), 'COPY ') === 0) { |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
50 | - * @return mixed |
|
50 | + * @return string |
|
51 | 51 | */ |
52 | 52 | public function getSkip() |
53 | 53 | { |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
66 | - * @return mixed |
|
66 | + * @return string |
|
67 | 67 | */ |
68 | 68 | public function getIncomplete() |
69 | 69 | { |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | |
81 | 81 | /** |
82 | 82 | * @param string|null $key |
83 | - * @return mixed |
|
83 | + * @return string |
|
84 | 84 | */ |
85 | 85 | public function getCurrent($key = null) |
86 | 86 | { |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | } |
165 | 165 | |
166 | 166 | /** |
167 | - * @param $service |
|
167 | + * @param string $service |
|
168 | 168 | * @return array |
169 | 169 | * @throws InjectionException |
170 | 170 | */ |
@@ -194,8 +194,8 @@ discard block |
||
194 | 194 | } |
195 | 195 | |
196 | 196 | /** |
197 | - * @param $type |
|
198 | - * @param $report |
|
197 | + * @param string $type |
|
198 | + * @param string $report |
|
199 | 199 | */ |
200 | 200 | public function addReport($type, $report) |
201 | 201 | { |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | * Returns test params like: env, group, skip, incomplete, etc |
207 | 207 | * Can return by annotation or return all if no key passed |
208 | 208 | * |
209 | - * @param null $key |
|
209 | + * @param string $key |
|
210 | 210 | * @return array|mixed|null |
211 | 211 | */ |
212 | 212 | public function getParam($key = null) |
@@ -33,6 +33,9 @@ discard block |
||
33 | 33 | */ |
34 | 34 | protected $primaryKeys = []; |
35 | 35 | |
36 | + /** |
|
37 | + * @param string $dsn |
|
38 | + */ |
|
36 | 39 | public static function connect($dsn, $user, $password, $options = null) |
37 | 40 | { |
38 | 41 | $dbh = new \PDO($dsn, $user, $password, $options); |
@@ -339,6 +342,9 @@ discard block |
||
339 | 342 | return empty($this->primaryKeys); |
340 | 343 | } |
341 | 344 | |
345 | + /** |
|
346 | + * @param string $table |
|
347 | + */ |
|
342 | 348 | public function update($table, array $data, array $criteria) |
343 | 349 | { |
344 | 350 | if (empty($data)) { |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | * @param array $files |
111 | 111 | * @param array $server |
112 | 112 | * @param null $content |
113 | - * @return mixed|Crawler |
|
113 | + * @return string |
|
114 | 114 | * @throws ExternalUrlException |
115 | 115 | * @see `_loadPage` |
116 | 116 | */ |
@@ -195,6 +195,9 @@ discard block |
||
195 | 195 | return $this->redirectIfNecessary($result, $maxRedirects, 0); |
196 | 196 | } |
197 | 197 | |
198 | + /** |
|
199 | + * @param string|false $domain |
|
200 | + */ |
|
198 | 201 | protected function isInternalDomain($domain) |
199 | 202 | { |
200 | 203 | if ($this->internalDomains === null) { |
@@ -266,6 +269,9 @@ discard block |
||
266 | 269 | return $this->client; |
267 | 270 | } |
268 | 271 | |
272 | + /** |
|
273 | + * @param string $filename |
|
274 | + */ |
|
269 | 275 | public function _savePageSource($filename) |
270 | 276 | { |
271 | 277 | file_put_contents($filename, $this->_getResponseContent()); |
@@ -381,7 +387,7 @@ discard block |
||
381 | 387 | |
382 | 388 | /** |
383 | 389 | * @param $link |
384 | - * @return bool |
|
390 | + * @return boolean|null |
|
385 | 391 | */ |
386 | 392 | protected function clickByLocator($link) |
387 | 393 | { |
@@ -615,6 +621,9 @@ discard block |
||
615 | 621 | $this->proceedSeeInFormFields($formSelector, $params, true); |
616 | 622 | } |
617 | 623 | |
624 | + /** |
|
625 | + * @param boolean $assertNot |
|
626 | + */ |
|
618 | 627 | protected function proceedSeeInFormFields($formSelector, array $params, $assertNot) |
619 | 628 | { |
620 | 629 | $form = $this->match($formSelector)->first(); |
@@ -859,6 +868,9 @@ discard block |
||
859 | 868 | $this->forms = []; |
860 | 869 | } |
861 | 870 | |
871 | + /** |
|
872 | + * @param string $selector |
|
873 | + */ |
|
862 | 874 | public function submitForm($selector, array $params, $button = null) |
863 | 875 | { |
864 | 876 | $form = $this->match($selector)->first(); |
@@ -1224,7 +1236,7 @@ discard block |
||
1224 | 1236 | * |
1225 | 1237 | * ``` |
1226 | 1238 | * |
1227 | - * @param $method |
|
1239 | + * @param string $method |
|
1228 | 1240 | * @param $uri |
1229 | 1241 | * @param $params |
1230 | 1242 | */ |
@@ -1394,6 +1406,9 @@ discard block |
||
1394 | 1406 | $this->fail("Element $nodes is not a form field or does not contain a form field"); |
1395 | 1407 | } |
1396 | 1408 | |
1409 | + /** |
|
1410 | + * @param string $name |
|
1411 | + */ |
|
1397 | 1412 | public function setCookie($name, $val, array $params = []) |
1398 | 1413 | { |
1399 | 1414 | $cookies = $this->client->getCookieJar(); |
@@ -1611,18 +1626,27 @@ discard block |
||
1611 | 1626 | $this->assertNotContains($title, $nodes->first()->text(), "page title contains $title"); |
1612 | 1627 | } |
1613 | 1628 | |
1629 | + /** |
|
1630 | + * @param Crawler $nodes |
|
1631 | + */ |
|
1614 | 1632 | protected function assertDomContains($nodes, $message, $text = '') |
1615 | 1633 | { |
1616 | 1634 | $constraint = new CrawlerConstraint($text, $this->_getCurrentUri()); |
1617 | 1635 | $this->assertThat($nodes, $constraint, $message); |
1618 | 1636 | } |
1619 | 1637 | |
1638 | + /** |
|
1639 | + * @param Crawler $nodes |
|
1640 | + */ |
|
1620 | 1641 | protected function assertDomNotContains($nodes, $message, $text = '') |
1621 | 1642 | { |
1622 | 1643 | $constraint = new CrawlerNotConstraint($text, $this->_getCurrentUri()); |
1623 | 1644 | $this->assertThat($nodes, $constraint, $message); |
1624 | 1645 | } |
1625 | 1646 | |
1647 | + /** |
|
1648 | + * @param string $needle |
|
1649 | + */ |
|
1626 | 1650 | protected function assertPageContains($needle, $message = '') |
1627 | 1651 | { |
1628 | 1652 | $constraint = new PageConstraint($needle, $this->_getCurrentUri()); |
@@ -1633,6 +1657,9 @@ discard block |
||
1633 | 1657 | ); |
1634 | 1658 | } |
1635 | 1659 | |
1660 | + /** |
|
1661 | + * @param string $needle |
|
1662 | + */ |
|
1636 | 1663 | protected function assertPageNotContains($needle, $message = '') |
1637 | 1664 | { |
1638 | 1665 | $constraint = new PageConstraint($needle, $this->_getCurrentUri()); |
@@ -1664,8 +1691,8 @@ discard block |
||
1664 | 1691 | } |
1665 | 1692 | |
1666 | 1693 | /** |
1667 | - * @param $name |
|
1668 | - * @param $form |
|
1694 | + * @param string|null $name |
|
1695 | + * @param Form $form |
|
1669 | 1696 | * @param $dynamicField |
1670 | 1697 | * @return FormField |
1671 | 1698 | */ |
@@ -1733,7 +1760,8 @@ discard block |
||
1733 | 1760 | } |
1734 | 1761 | |
1735 | 1762 | /** |
1736 | - * @param $result |
|
1763 | + * @param Crawler|null $result |
|
1764 | + * @param integer $redirectCount |
|
1737 | 1765 | * @return mixed |
1738 | 1766 | */ |
1739 | 1767 | protected function redirectIfNecessary($result, $maxRedirects, $redirectCount) |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | * $mailer = $I->grabComponent('mailer'); |
536 | 536 | * ``` |
537 | 537 | * |
538 | - * @param $component |
|
538 | + * @param string $component |
|
539 | 539 | * @return mixed |
540 | 540 | * @throws ModuleException |
541 | 541 | */ |
@@ -656,7 +656,7 @@ discard block |
||
656 | 656 | /** |
657 | 657 | * Returns a list of regex patterns for recognized domain names |
658 | 658 | * |
659 | - * @return array |
|
659 | + * @return string[] |
|
660 | 660 | */ |
661 | 661 | public function getInternalDomains() |
662 | 662 | { |
@@ -683,7 +683,7 @@ discard block |
||
683 | 683 | /** |
684 | 684 | * Sets a cookie and, if validation is enabled, signs it. |
685 | 685 | * @param string $name The name of the cookie |
686 | - * @param string $value The value of the cookie |
|
686 | + * @param string $val The value of the cookie |
|
687 | 687 | * @param array $params Additional cookie params like `domain`, `path`, `expires` and `secure`. |
688 | 688 | */ |
689 | 689 | public function setCookie($name, $val, array $params = []) |
@@ -634,7 +634,7 @@ discard block |
||
634 | 634 | * Returns URL of a host. |
635 | 635 | * |
636 | 636 | * @api |
637 | - * @return mixed |
|
637 | + * @return string |
|
638 | 638 | * @throws ModuleConfigException |
639 | 639 | */ |
640 | 640 | public function _getUrl() |
@@ -685,6 +685,9 @@ discard block |
||
685 | 685 | return Uri::retrieveUri($url); |
686 | 686 | } |
687 | 687 | |
688 | + /** |
|
689 | + * @param string $filename |
|
690 | + */ |
|
688 | 691 | public function _saveScreenshot($filename) |
689 | 692 | { |
690 | 693 | if (!isset($this->webDriver)) { |
@@ -705,7 +708,7 @@ discard block |
||
705 | 708 | |
706 | 709 | /** |
707 | 710 | * Saves HTML source of a page to a file |
708 | - * @param $filename |
|
711 | + * @param string $filename |
|
709 | 712 | */ |
710 | 713 | public function _savePageSource($filename) |
711 | 714 | { |
@@ -840,6 +843,9 @@ discard block |
||
840 | 843 | return $this->webDriver->getPageSource(); |
841 | 844 | } |
842 | 845 | |
846 | + /** |
|
847 | + * @param Cookie[] $cookies |
|
848 | + */ |
|
843 | 849 | protected function filterCookies($cookies, $params = []) |
844 | 850 | { |
845 | 851 | foreach (['domain', 'path', 'name'] as $filter) { |
@@ -848,6 +854,10 @@ discard block |
||
848 | 854 | } |
849 | 855 | $cookies = array_filter( |
850 | 856 | $cookies, |
857 | + |
|
858 | + /** |
|
859 | + * @param Cookie[] $item |
|
860 | + */ |
|
851 | 861 | function ($item) use ($filter, $params) { |
852 | 862 | return $item[$filter] == $params[$filter]; |
853 | 863 | } |
@@ -1111,7 +1121,7 @@ discard block |
||
1111 | 1121 | |
1112 | 1122 | /** |
1113 | 1123 | * @param string $url |
1114 | - * @param $nodes |
|
1124 | + * @param RemoteWebElement[] $nodes |
|
1115 | 1125 | * @return array |
1116 | 1126 | */ |
1117 | 1127 | private function filterNodesByHref($url, $nodes) |
@@ -1208,6 +1218,9 @@ discard block |
||
1208 | 1218 | $this->proceedSeeInFormFields($formSelector, $params, true); |
1209 | 1219 | } |
1210 | 1220 | |
1221 | + /** |
|
1222 | + * @param boolean $assertNot |
|
1223 | + */ |
|
1211 | 1224 | protected function proceedSeeInFormFields($formSelector, array $params, $assertNot) |
1212 | 1225 | { |
1213 | 1226 | $form = $this->match($this->baseElement, $formSelector); |
@@ -1593,6 +1606,9 @@ discard block |
||
1593 | 1606 | return $els; |
1594 | 1607 | } |
1595 | 1608 | |
1609 | + /** |
|
1610 | + * @param WebDriverElement $option |
|
1611 | + */ |
|
1596 | 1612 | public function checkOption($option) |
1597 | 1613 | { |
1598 | 1614 | $field = $this->findCheckable($this->webDriver, $option); |
@@ -1605,6 +1621,9 @@ discard block |
||
1605 | 1621 | $field->click(); |
1606 | 1622 | } |
1607 | 1623 | |
1624 | + /** |
|
1625 | + * @param WebDriverElement $option |
|
1626 | + */ |
|
1608 | 1627 | public function uncheckOption($option) |
1609 | 1628 | { |
1610 | 1629 | $field = $this->findCheckable($this->baseElement, $option); |
@@ -1617,6 +1636,9 @@ discard block |
||
1617 | 1636 | $field->click(); |
1618 | 1637 | } |
1619 | 1638 | |
1639 | + /** |
|
1640 | + * @param WebDriverElement $field |
|
1641 | + */ |
|
1620 | 1642 | public function fillField($field, $value) |
1621 | 1643 | { |
1622 | 1644 | $el = $this->findField($field); |
@@ -1969,6 +1991,9 @@ discard block |
||
1969 | 1991 | $this->debug($this->_getCurrentUri()); |
1970 | 1992 | } |
1971 | 1993 | |
1994 | + /** |
|
1995 | + * @return integer |
|
1996 | + */ |
|
1972 | 1997 | protected function getSubmissionFormFieldName($name) |
1973 | 1998 | { |
1974 | 1999 | if (substr($name, -2) === '[]') { |
@@ -2374,7 +2399,7 @@ discard block |
||
2374 | 2399 | * Try not to use this command on a regular basis. |
2375 | 2400 | * If Codeception lacks a feature you need, please implement it and submit a patch. |
2376 | 2401 | * |
2377 | - * @param callable $function |
|
2402 | + * @param \Closure $function |
|
2378 | 2403 | */ |
2379 | 2404 | public function executeInSelenium(\Closure $function) |
2380 | 2405 | { |
@@ -2492,7 +2517,7 @@ discard block |
||
2492 | 2517 | * $I->executeJS("window.alert(arguments[0])", ['Hello world']); |
2493 | 2518 | * ``` |
2494 | 2519 | * |
2495 | - * @param $script |
|
2520 | + * @param string $script |
|
2496 | 2521 | * @param array $arguments |
2497 | 2522 | * @return mixed |
2498 | 2523 | */ |
@@ -2834,16 +2859,25 @@ discard block |
||
2834 | 2859 | return $keys; |
2835 | 2860 | } |
2836 | 2861 | |
2862 | + /** |
|
2863 | + * @param string $selector |
|
2864 | + */ |
|
2837 | 2865 | protected function assertNodesContain($text, $nodes, $selector = null) |
2838 | 2866 | { |
2839 | 2867 | $this->assertThat($nodes, new WebDriverConstraint($text, $this->_getCurrentUri()), $selector); |
2840 | 2868 | } |
2841 | 2869 | |
2870 | + /** |
|
2871 | + * @param string $selector |
|
2872 | + */ |
|
2842 | 2873 | protected function assertNodesNotContain($text, $nodes, $selector = null) |
2843 | 2874 | { |
2844 | 2875 | $this->assertThat($nodes, new WebDriverConstraintNot($text, $this->_getCurrentUri()), $selector); |
2845 | 2876 | } |
2846 | 2877 | |
2878 | + /** |
|
2879 | + * @param string $needle |
|
2880 | + */ |
|
2847 | 2881 | protected function assertPageContains($needle, $message = '') |
2848 | 2882 | { |
2849 | 2883 | $this->assertThat( |
@@ -2853,6 +2887,9 @@ discard block |
||
2853 | 2887 | ); |
2854 | 2888 | } |
2855 | 2889 | |
2890 | + /** |
|
2891 | + * @param string $needle |
|
2892 | + */ |
|
2856 | 2893 | protected function assertPageNotContains($needle, $message = '') |
2857 | 2894 | { |
2858 | 2895 | $this->assertThatItsNot( |
@@ -3037,7 +3074,7 @@ discard block |
||
3037 | 3074 | /** |
3038 | 3075 | * Check if the cookie domain matches the config URL. |
3039 | 3076 | * |
3040 | - * @param array|Cookie $cookie |
|
3077 | + * @param Cookie $cookie |
|
3041 | 3078 | * @return bool |
3042 | 3079 | */ |
3043 | 3080 | private function cookieDomainMatchesConfigUrl($cookie) |
@@ -3162,6 +3199,11 @@ discard block |
||
3162 | 3199 | $this->switchToNextTab(0 - $offset); |
3163 | 3200 | } |
3164 | 3201 | |
3202 | + /** |
|
3203 | + * @param integer $offset |
|
3204 | + * |
|
3205 | + * @return string |
|
3206 | + */ |
|
3165 | 3207 | protected function getRelativeTabHandle($offset) |
3166 | 3208 | { |
3167 | 3209 | if ($this->isPhantom()) { |
@@ -360,6 +360,9 @@ discard block |
||
360 | 360 | $this->printExceptionTrace($fail); |
361 | 361 | } |
362 | 362 | |
363 | + /** |
|
364 | + * @param string $cause |
|
365 | + */ |
|
363 | 366 | public function printException($e, $cause = null) |
364 | 367 | { |
365 | 368 | if ($e instanceof \PHPUnit\Framework\SkippedTestError or $e instanceof \PHPUnit\Framework_IncompleteTestError) { |
@@ -404,6 +407,9 @@ discard block |
||
404 | 407 | $message->writeln(); |
405 | 408 | } |
406 | 409 | |
410 | + /** |
|
411 | + * @param \Exception $fail |
|
412 | + */ |
|
407 | 413 | public function printScenarioFail(ScenarioDriven $failedTest, $fail) |
408 | 414 | { |
409 | 415 | if ($this->conditionalFails) { |
@@ -28,6 +28,9 @@ |
||
28 | 28 | $this->tests = $queue; |
29 | 29 | } |
30 | 30 | |
31 | + /** |
|
32 | + * @param \PHPUnit\Framework\TestCase $test |
|
33 | + */ |
|
31 | 34 | protected function getDependencies($test) |
32 | 35 | { |
33 | 36 | if (!$test instanceof Dependent) { |