@@ -21,19 +21,19 @@ discard block |
||
21 | 21 | 'region' => $config['region'], |
22 | 22 | ]; |
23 | 23 | |
24 | - if (! empty($config['key']) && ! empty($config['secret'])) { |
|
24 | + if (!empty($config['key']) && !empty($config['secret'])) { |
|
25 | 25 | $params['credentials'] = new Credentials($config['key'], $config['secret']); |
26 | 26 | } |
27 | 27 | |
28 | - if (! empty($config['profile'])) { |
|
28 | + if (!empty($config['profile'])) { |
|
29 | 29 | $params['profile'] = $config['profile']; |
30 | 30 | } |
31 | 31 | |
32 | - if (! empty($config['version'])) { |
|
32 | + if (!empty($config['version'])) { |
|
33 | 33 | $params['version'] = $config['version']; |
34 | 34 | } |
35 | 35 | |
36 | - if (! empty($config['endpoint'])) { |
|
36 | + if (!empty($config['endpoint'])) { |
|
37 | 37 | $params['endpoint'] = $config['endpoint']; |
38 | 38 | } |
39 | 39 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | return $queueURL; |
138 | 138 | } |
139 | 139 | } |
140 | - throw new TestRuntimeException('queue [' . $queue . '] not found'); |
|
140 | + throw new TestRuntimeException('queue ['.$queue.'] not found'); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | public function getRequiredConfig() |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | $interfaces = class_implements($commandClass); |
83 | 83 | |
84 | 84 | if (!in_array('Codeception\CustomCommandInterface', $interfaces)) { |
85 | - throw new ConfigurationException("Extension: Command {$commandClass} must implement " . |
|
85 | + throw new ConfigurationException("Extension: Command {$commandClass} must implement ". |
|
86 | 86 | "the interface `Codeception\\CustomCommandInterface`"); |
87 | 87 | } |
88 | 88 | |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | $this->preloadConfiguration($argv[++$i]); |
151 | 151 | } |
152 | 152 | if (!empty($match[1])) { |
153 | - $argvWithoutConfig[] = "-" . $match[1]; //rest commands |
|
153 | + $argvWithoutConfig[] = "-".$match[1]; //rest commands |
|
154 | 154 | } |
155 | 155 | continue; |
156 | 156 | } |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | implode( |
138 | 138 | ', ', |
139 | 139 | array_map( |
140 | - function ($module) { |
|
140 | + function($module) { |
|
141 | 141 | return $module->_getName(); |
142 | 142 | }, |
143 | 143 | $e->getSuite()->getModules() |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | return $path; |
218 | 218 | } |
219 | 219 | |
220 | - return codecept_output_dir() . $path; |
|
220 | + return codecept_output_dir().$path; |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | public function testSuccess(TestEvent $e) |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | } |
295 | 295 | $metaStep = $e->getStep()->getMetaStep(); |
296 | 296 | if ($metaStep and $this->metaStep != $metaStep) { |
297 | - $this->message(' ' . $metaStep->getPrefix()) |
|
297 | + $this->message(' '.$metaStep->getPrefix()) |
|
298 | 298 | ->style('bold') |
299 | 299 | ->append($metaStep->__toString()) |
300 | 300 | ->writeln(); |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | $messages = Notification::all(); |
333 | 333 | foreach (array_count_values($messages) as $message => $count) { |
334 | 334 | if ($count > 1) { |
335 | - $message = $count . 'x ' . $message; |
|
335 | + $message = $count.'x '.$message; |
|
336 | 336 | } |
337 | 337 | $this->output->notification($message); |
338 | 338 | } |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | $failedTest = $e->getTest(); |
344 | 344 | $fail = $e->getFail(); |
345 | 345 | |
346 | - $this->output->write($e->getCount() . ") "); |
|
346 | + $this->output->write($e->getCount().") "); |
|
347 | 347 | $this->writeCurrentTest($failedTest, false); |
348 | 348 | $this->output->writeln(''); |
349 | 349 | $this->message("<error> Test </error> ") |
@@ -407,11 +407,11 @@ discard block |
||
407 | 407 | public function printScenarioFail(ScenarioDriven $failedTest, $fail) |
408 | 408 | { |
409 | 409 | if ($this->conditionalFails) { |
410 | - $failedStep = (string) array_shift($this->conditionalFails); |
|
410 | + $failedStep = (string)array_shift($this->conditionalFails); |
|
411 | 411 | } else { |
412 | - $failedStep = (string) $failedTest->getScenario()->getMetaStep(); |
|
412 | + $failedStep = (string)$failedTest->getScenario()->getMetaStep(); |
|
413 | 413 | if ($failedStep === '') { |
414 | - $failedStep = (string) array_shift($this->failedStep); |
|
414 | + $failedStep = (string)array_shift($this->failedStep); |
|
415 | 415 | } |
416 | 416 | } |
417 | 417 | |
@@ -465,7 +465,7 @@ discard block |
||
465 | 465 | $message->writeln(); |
466 | 466 | continue; |
467 | 467 | } |
468 | - $message->append($step['file'] . ':' . $step['line']); |
|
468 | + $message->append($step['file'].':'.$step['line']); |
|
469 | 469 | $message->writeln(); |
470 | 470 | } |
471 | 471 | |
@@ -535,14 +535,14 @@ discard block |
||
535 | 535 | if (getenv('COLUMNS')) { |
536 | 536 | $this->width = getenv('COLUMNS'); |
537 | 537 | } else { |
538 | - $this->width = (int) (`command -v tput >> /dev/null 2>&1 && tput cols`) - 2; |
|
538 | + $this->width = (int)(`command -v tput >> /dev/null 2>&1 && tput cols`) - 2; |
|
539 | 539 | } |
540 | 540 | } elseif ($this->isWin() && (php_sapi_name() === "cli")) { |
541 | 541 | exec('mode con', $output); |
542 | 542 | if (isset($output[4])) { |
543 | 543 | preg_match('/^ +.* +(\d+)$/', $output[4], $matches); |
544 | 544 | if (!empty($matches[1])) { |
545 | - $this->width = (int) $matches[1]; |
|
545 | + $this->width = (int)$matches[1]; |
|
546 | 546 | } |
547 | 547 | } |
548 | 548 | } |
@@ -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) { |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | return; |
63 | 63 | } |
64 | 64 | $filename = preg_replace('~\W~', '.', Descriptor::getTestSignatureUnique($test)); |
65 | - $filename = mb_strcut($filename, 0, 244, 'utf-8') . '.fail.html'; |
|
66 | - $this->_savePageSource($report = codecept_output_dir() . $filename); |
|
65 | + $filename = mb_strcut($filename, 0, 244, 'utf-8').'.fail.html'; |
|
66 | + $this->_savePageSource($report = codecept_output_dir().$filename); |
|
67 | 67 | $test->getMetadata()->addReport('html', $report); |
68 | 68 | } |
69 | 69 | |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | if (preg_match('#^(//|https?://(?!localhost))#', $uri)) { |
174 | 174 | $hostname = parse_url($uri, PHP_URL_HOST); |
175 | 175 | if (!$this->isInternalDomain($hostname)) { |
176 | - throw new ExternalUrlException(get_class($this) . " can't open external URL: " . $uri); |
|
176 | + throw new ExternalUrlException(get_class($this)." can't open external URL: ".$uri); |
|
177 | 177 | } |
178 | 178 | } |
179 | 179 | |
@@ -501,12 +501,12 @@ discard block |
||
501 | 501 | { |
502 | 502 | $crawler = $this->getCrawler()->selectLink($text); |
503 | 503 | if ($crawler->count() === 0) { |
504 | - $this->fail("No links containing text '$text' were found in page " . $this->_getCurrentUri()); |
|
504 | + $this->fail("No links containing text '$text' were found in page ".$this->_getCurrentUri()); |
|
505 | 505 | } |
506 | 506 | if ($url) { |
507 | 507 | $crawler = $crawler->filterXPath(sprintf('.//a[contains(@href, %s)]', Crawler::xpathLiteral($url))); |
508 | 508 | if ($crawler->count() === 0) { |
509 | - $this->fail("No links containing text '$text' and URL '$url' were found in page " . $this->_getCurrentUri()); |
|
509 | + $this->fail("No links containing text '$text' and URL '$url' were found in page ".$this->_getCurrentUri()); |
|
510 | 510 | } |
511 | 511 | } |
512 | 512 | $this->assertTrue(true); |
@@ -517,12 +517,12 @@ discard block |
||
517 | 517 | $crawler = $this->getCrawler()->selectLink($text); |
518 | 518 | if (!$url) { |
519 | 519 | if ($crawler->count() > 0) { |
520 | - $this->fail("Link containing text '$text' was found in page " . $this->_getCurrentUri()); |
|
520 | + $this->fail("Link containing text '$text' was found in page ".$this->_getCurrentUri()); |
|
521 | 521 | } |
522 | 522 | } |
523 | 523 | $crawler = $crawler->filterXPath(sprintf('.//a[contains(@href, %s)]', Crawler::xpathLiteral($url))); |
524 | 524 | if ($crawler->count() > 0) { |
525 | - $this->fail("Link containing text '$text' and URL '$url' was found in page " . $this->_getCurrentUri()); |
|
525 | + $this->fail("Link containing text '$text' and URL '$url' was found in page ".$this->_getCurrentUri()); |
|
526 | 526 | } |
527 | 527 | } |
528 | 528 | |
@@ -573,7 +573,7 @@ discard block |
||
573 | 573 | $matches = []; |
574 | 574 | $res = preg_match($uri, $this->_getCurrentUri(), $matches); |
575 | 575 | if (!$res) { |
576 | - $this->fail("Couldn't match $uri in " . $this->_getCurrentUri()); |
|
576 | + $this->fail("Couldn't match $uri in ".$this->_getCurrentUri()); |
|
577 | 577 | } |
578 | 578 | if (!isset($matches[1])) { |
579 | 579 | $this->fail("Nothing to grab. A regex parameter required. Ex: '/user/(\\d+)'"); |
@@ -839,7 +839,7 @@ discard block |
||
839 | 839 | |
840 | 840 | $url = $this->getFormUrl($frmCrawl); |
841 | 841 | if (strcasecmp($form->getMethod(), 'GET') === 0) { |
842 | - $url = Uri::mergeUrls($url, '?' . http_build_query($requestParams)); |
|
842 | + $url = Uri::mergeUrls($url, '?'.http_build_query($requestParams)); |
|
843 | 843 | } |
844 | 844 | |
845 | 845 | $url = preg_replace('/#.*/', '', $url); |
@@ -848,7 +848,7 @@ discard block |
||
848 | 848 | $this->debugSection('Method', $form->getMethod()); |
849 | 849 | $this->debugSection('Parameters', $requestParams); |
850 | 850 | |
851 | - $requestParams= $this->getFormPhpValues($requestParams); |
|
851 | + $requestParams = $this->getFormPhpValues($requestParams); |
|
852 | 852 | |
853 | 853 | $this->crawler = $this->clientRequest( |
854 | 854 | $form->getMethod(), |
@@ -1154,7 +1154,7 @@ discard block |
||
1154 | 1154 | public function attachFile($field, $filename) |
1155 | 1155 | { |
1156 | 1156 | $form = $this->getFormFor($field = $this->getFieldByLabelOrCss($field)); |
1157 | - $filePath = codecept_data_dir() . $filename; |
|
1157 | + $filePath = codecept_data_dir().$filename; |
|
1158 | 1158 | if (!file_exists($filePath)) { |
1159 | 1159 | throw new \InvalidArgumentException("File does not exist: $filePath"); |
1160 | 1160 | } |
@@ -1310,7 +1310,7 @@ discard block |
||
1310 | 1310 | { |
1311 | 1311 | foreach ($attributes as $attr => $val) { |
1312 | 1312 | $nodes = $nodes->reduce( |
1313 | - function (Crawler $node) use ($attr, $val) { |
|
1313 | + function(Crawler $node) use ($attr, $val) { |
|
1314 | 1314 | return $node->attr($attr) == $val; |
1315 | 1315 | } |
1316 | 1316 | ); |
@@ -1401,11 +1401,11 @@ discard block |
||
1401 | 1401 | |
1402 | 1402 | $expires = isset($params['expiry']) ? $params['expiry'] : null; // WebDriver compatibility |
1403 | 1403 | $expires = isset($params['expires']) && !$expires ? $params['expires'] : null; |
1404 | - $path = isset($params['path']) ? $params['path'] : null; |
|
1405 | - $domain = isset($params['domain']) ? $params['domain'] : ''; |
|
1406 | - $secure = isset($params['secure']) ? $params['secure'] : false; |
|
1407 | - $httpOnly = isset($params['httpOnly']) ? $params['httpOnly'] : true; |
|
1408 | - $encodedValue = isset($params['encodedValue']) ? $params['encodedValue'] : false; |
|
1404 | + $path = isset($params['path']) ? $params['path'] : null; |
|
1405 | + $domain = isset($params['domain']) ? $params['domain'] : ''; |
|
1406 | + $secure = isset($params['secure']) ? $params['secure'] : false; |
|
1407 | + $httpOnly = isset($params['httpOnly']) ? $params['httpOnly'] : true; |
|
1408 | + $encodedValue = isset($params['encodedValue']) ? $params['encodedValue'] : false; |
|
1409 | 1409 | |
1410 | 1410 | |
1411 | 1411 | |
@@ -1471,7 +1471,7 @@ discard block |
||
1471 | 1471 | $selector = $this->stringifySelector($selector); |
1472 | 1472 | if (!empty($attributes)) { |
1473 | 1473 | $nodes = $this->filterByAttributes($nodes, $attributes); |
1474 | - $selector .= "' with attribute(s) '" . trim(json_encode($attributes), '{}'); |
|
1474 | + $selector .= "' with attribute(s) '".trim(json_encode($attributes), '{}'); |
|
1475 | 1475 | } |
1476 | 1476 | $this->assertDomContains($nodes, $selector); |
1477 | 1477 | } |
@@ -1482,7 +1482,7 @@ discard block |
||
1482 | 1482 | $selector = $this->stringifySelector($selector); |
1483 | 1483 | if (!empty($attributes)) { |
1484 | 1484 | $nodes = $this->filterByAttributes($nodes, $attributes); |
1485 | - $selector .= "' with attribute(s) '" . trim(json_encode($attributes), '{}'); |
|
1485 | + $selector .= "' with attribute(s) '".trim(json_encode($attributes), '{}'); |
|
1486 | 1486 | } |
1487 | 1487 | $this->assertDomNotContains($nodes, $selector); |
1488 | 1488 | } |
@@ -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 = []) |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | $this->config['password'] |
99 | 99 | ); |
100 | 100 | } catch (\MongoConnectionException $e) { |
101 | - throw new ModuleException(__CLASS__, $e->getMessage() . ' while creating Mongo connection'); |
|
101 | + throw new ModuleException(__CLASS__, $e->getMessage().' while creating Mongo connection'); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | // starting with loading dump |
@@ -112,14 +112,14 @@ discard block |
||
112 | 112 | private function validateDump() |
113 | 113 | { |
114 | 114 | if ($this->config['dump'] && ($this->config['cleanup'] or ($this->config['populate']))) { |
115 | - if (!file_exists(Configuration::projectDir() . $this->config['dump'])) { |
|
115 | + if (!file_exists(Configuration::projectDir().$this->config['dump'])) { |
|
116 | 116 | throw new ModuleConfigException( |
117 | 117 | __CLASS__, |
118 | 118 | "File with dump doesn't exist.\n |
119 | 119 | Please, check path for dump file: " . $this->config['dump'] |
120 | 120 | ); |
121 | 121 | } |
122 | - $this->dumpFile = Configuration::projectDir() . $this->config['dump']; |
|
122 | + $this->dumpFile = Configuration::projectDir().$this->config['dump']; |
|
123 | 123 | $this->isDumpFileEmpty = false; |
124 | 124 | |
125 | 125 | if ($this->config['dump_type'] === self::DUMP_TYPE_JS) { |
@@ -171,9 +171,9 @@ discard block |
||
171 | 171 | throw new ModuleConfigException( |
172 | 172 | __CLASS__, |
173 | 173 | '\"dump_type\" must be one of ["' |
174 | - . self::DUMP_TYPE_JS . '", "' |
|
175 | - . self::DUMP_TYPE_MONGODUMP . '", "' |
|
176 | - . self::DUMP_TYPE_MONGODUMP_TAR_GZ . '"].' |
|
174 | + . self::DUMP_TYPE_JS.'", "' |
|
175 | + . self::DUMP_TYPE_MONGODUMP.'", "' |
|
176 | + . self::DUMP_TYPE_MONGODUMP_TAR_GZ.'"].' |
|
177 | 177 | ); |
178 | 178 | } |
179 | 179 | } |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | } |
269 | 269 | |
270 | 270 | $response = $collection->insertOne($data); |
271 | - return (string) $response->getInsertedId(); |
|
271 | + return (string)$response->getInsertedId(); |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | /** |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | 'run_database_seeder' => false, |
129 | 129 | 'database_seeder_class' => '', |
130 | 130 | 'environment_file' => '.env', |
131 | - 'bootstrap' => 'bootstrap' . DIRECTORY_SEPARATOR . 'app.php', |
|
131 | + 'bootstrap' => 'bootstrap'.DIRECTORY_SEPARATOR.'app.php', |
|
132 | 132 | 'root' => '', |
133 | 133 | 'packages' => 'workbench', |
134 | 134 | 'vendor_dir' => 'vendor', |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | $projectDir .= $this->config['root']; |
145 | 145 | |
146 | 146 | $this->config['project_dir'] = $projectDir; |
147 | - $this->config['bootstrap_file'] = $projectDir . $this->config['bootstrap']; |
|
147 | + $this->config['bootstrap_file'] = $projectDir.$this->config['bootstrap']; |
|
148 | 148 | |
149 | 149 | parent::__construct($container); |
150 | 150 | } |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | */ |
227 | 227 | private function applicationUsesDatabase() |
228 | 228 | { |
229 | - return ! empty($this->app['config']['database.default']); |
|
229 | + return !empty($this->app['config']['database.default']); |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | /** |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | */ |
253 | 253 | protected function registerAutoloaders() |
254 | 254 | { |
255 | - require $this->config['project_dir'] . $this->config['vendor_dir'] . DIRECTORY_SEPARATOR . 'autoload.php'; |
|
255 | + require $this->config['project_dir'].$this->config['vendor_dir'].DIRECTORY_SEPARATOR.'autoload.php'; |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | /** |
@@ -561,7 +561,7 @@ discard block |
||
561 | 561 | $rootNamespace = $this->getRootControllerNamespace(); |
562 | 562 | |
563 | 563 | if ($rootNamespace && !(strpos($action, '\\') === 0)) { |
564 | - return $rootNamespace . '\\' . $action; |
|
564 | + return $rootNamespace.'\\'.$action; |
|
565 | 565 | } |
566 | 566 | |
567 | 567 | return trim($action, '\\'); |
@@ -604,11 +604,11 @@ discard block |
||
604 | 604 | return; |
605 | 605 | } |
606 | 606 | |
607 | - if (! $this->app['session']->has($key)) { |
|
607 | + if (!$this->app['session']->has($key)) { |
|
608 | 608 | $this->fail("No session variable with key '$key'"); |
609 | 609 | } |
610 | 610 | |
611 | - if (! is_null($value)) { |
|
611 | + if (!is_null($value)) { |
|
612 | 612 | $this->assertEquals($value, $this->app['session']->get($key)); |
613 | 613 | } |
614 | 614 | } |
@@ -671,7 +671,7 @@ discard block |
||
671 | 671 | { |
672 | 672 | $viewErrorBag = $this->app->make('view')->shared('errors'); |
673 | 673 | if (count($viewErrorBag) > 0) { |
674 | - $this->fail("Found the following form errors: \n\n" . $viewErrorBag->toJson(JSON_PRETTY_PRINT)); |
|
674 | + $this->fail("Found the following form errors: \n\n".$viewErrorBag->toJson(JSON_PRETTY_PRINT)); |
|
675 | 675 | } |
676 | 676 | } |
677 | 677 | |
@@ -723,7 +723,7 @@ discard block |
||
723 | 723 | $this->fail("No form error message for key '$key'\n"); |
724 | 724 | } |
725 | 725 | |
726 | - if (! is_null($expectedErrorMessage)) { |
|
726 | + if (!is_null($expectedErrorMessage)) { |
|
727 | 727 | $this->assertContains($expectedErrorMessage, $viewErrorBag->first($key)); |
728 | 728 | } |
729 | 729 | } |
@@ -765,8 +765,8 @@ discard block |
||
765 | 765 | return; |
766 | 766 | } |
767 | 767 | |
768 | - if (! $guard->attempt($user)) { |
|
769 | - $this->fail("Failed to login with credentials " . json_encode($user)); |
|
768 | + if (!$guard->attempt($user)) { |
|
769 | + $this->fail("Failed to login with credentials ".json_encode($user)); |
|
770 | 770 | } |
771 | 771 | } |
772 | 772 | |
@@ -791,7 +791,7 @@ discard block |
||
791 | 791 | $auth = $auth->guard($guard); |
792 | 792 | } |
793 | 793 | |
794 | - if (! $auth->check()) { |
|
794 | + if (!$auth->check()) { |
|
795 | 795 | $this->fail("There is no authenticated user"); |
796 | 796 | } |
797 | 797 | } |
@@ -864,7 +864,7 @@ discard block |
||
864 | 864 | if (class_exists($table)) { |
865 | 865 | $model = new $table; |
866 | 866 | |
867 | - if (! $model instanceof EloquentModel) { |
|
867 | + if (!$model instanceof EloquentModel) { |
|
868 | 868 | throw new \RuntimeException("Class $table is not an Eloquent model"); |
869 | 869 | } |
870 | 870 | |
@@ -876,7 +876,7 @@ discard block |
||
876 | 876 | try { |
877 | 877 | return $this->app['db']->table($table)->insertGetId($attributes); |
878 | 878 | } catch (\Exception $e) { |
879 | - $this->fail("Could not insert record into table '$table':\n\n" . $e->getMessage()); |
|
879 | + $this->fail("Could not insert record into table '$table':\n\n".$e->getMessage()); |
|
880 | 880 | } |
881 | 881 | } |
882 | 882 | |
@@ -898,10 +898,10 @@ discard block |
||
898 | 898 | public function seeRecord($table, $attributes = []) |
899 | 899 | { |
900 | 900 | if (class_exists($table)) { |
901 | - if (! $this->findModel($table, $attributes)) { |
|
902 | - $this->fail("Could not find $table with " . json_encode($attributes)); |
|
901 | + if (!$this->findModel($table, $attributes)) { |
|
902 | + $this->fail("Could not find $table with ".json_encode($attributes)); |
|
903 | 903 | } |
904 | - } elseif (! $this->findRecord($table, $attributes)) { |
|
904 | + } elseif (!$this->findRecord($table, $attributes)) { |
|
905 | 905 | $this->fail("Could not find matching record in table '$table'"); |
906 | 906 | } |
907 | 907 | } |
@@ -925,7 +925,7 @@ discard block |
||
925 | 925 | { |
926 | 926 | if (class_exists($table)) { |
927 | 927 | if ($this->findModel($table, $attributes)) { |
928 | - $this->fail("Unexpectedly found matching $table with " . json_encode($attributes)); |
|
928 | + $this->fail("Unexpectedly found matching $table with ".json_encode($attributes)); |
|
929 | 929 | } |
930 | 930 | } elseif ($this->findRecord($table, $attributes)) { |
931 | 931 | $this->fail("Unexpectedly found matching record in table '$table'"); |
@@ -952,14 +952,14 @@ discard block |
||
952 | 952 | public function grabRecord($table, $attributes = []) |
953 | 953 | { |
954 | 954 | if (class_exists($table)) { |
955 | - if (! $model = $this->findModel($table, $attributes)) { |
|
956 | - $this->fail("Could not find $table with " . json_encode($attributes)); |
|
955 | + if (!$model = $this->findModel($table, $attributes)) { |
|
956 | + $this->fail("Could not find $table with ".json_encode($attributes)); |
|
957 | 957 | } |
958 | 958 | |
959 | 959 | return $model; |
960 | 960 | } |
961 | 961 | |
962 | - if (! $record = $this->findRecord($table, $attributes)) { |
|
962 | + if (!$record = $this->findRecord($table, $attributes)) { |
|
963 | 963 | $this->fail("Could not find matching record in table '$table'"); |
964 | 964 | } |
965 | 965 | |
@@ -987,12 +987,12 @@ discard block |
||
987 | 987 | if (class_exists($table)) { |
988 | 988 | $currentNum = $this->countModels($table, $attributes); |
989 | 989 | if ($currentNum != $expectedNum) { |
990 | - $this->fail("The number of found $table ($currentNum) does not match expected number $expectedNum with " . json_encode($attributes)); |
|
990 | + $this->fail("The number of found $table ($currentNum) does not match expected number $expectedNum with ".json_encode($attributes)); |
|
991 | 991 | } |
992 | 992 | } else { |
993 | 993 | $currentNum = $this->countRecords($table, $attributes); |
994 | 994 | if ($currentNum != $expectedNum) { |
995 | - $this->fail("The number of found records ($currentNum) does not match expected number $expectedNum in table $table with " . json_encode($attributes)); |
|
995 | + $this->fail("The number of found records ($currentNum) does not match expected number $expectedNum in table $table with ".json_encode($attributes)); |
|
996 | 996 | } |
997 | 997 | } |
998 | 998 | } |
@@ -1015,7 +1015,7 @@ discard block |
||
1015 | 1015 | */ |
1016 | 1016 | public function grabNumRecords($table, $attributes = []) |
1017 | 1017 | { |
1018 | - return class_exists($table)? $this->countModels($table, $attributes) : $this->countRecords($table, $attributes); |
|
1018 | + return class_exists($table) ? $this->countModels($table, $attributes) : $this->countRecords($table, $attributes); |
|
1019 | 1019 | } |
1020 | 1020 | |
1021 | 1021 | /** |
@@ -1046,7 +1046,7 @@ discard block |
||
1046 | 1046 | $query->where($key, $value); |
1047 | 1047 | } |
1048 | 1048 | |
1049 | - return (array) $query->first(); |
|
1049 | + return (array)$query->first(); |
|
1050 | 1050 | } |
1051 | 1051 | |
1052 | 1052 | /** |
@@ -1136,7 +1136,7 @@ discard block |
||
1136 | 1136 | |
1137 | 1137 | return $result; |
1138 | 1138 | } catch (\Exception $e) { |
1139 | - $this->fail("Could not create model: \n\n" . get_class($e) . "\n\n" . $e->getMessage()); |
|
1139 | + $this->fail("Could not create model: \n\n".get_class($e)."\n\n".$e->getMessage()); |
|
1140 | 1140 | } |
1141 | 1141 | } |
1142 | 1142 | |
@@ -1165,7 +1165,7 @@ discard block |
||
1165 | 1165 | try { |
1166 | 1166 | return $this->modelFactory($model, $name, $times)->create($attributes); |
1167 | 1167 | } catch (\Exception $e) { |
1168 | - $this->fail("Could not create model: \n\n" . get_class($e) . "\n\n" . $e->getMessage()); |
|
1168 | + $this->fail("Could not create model: \n\n".get_class($e)."\n\n".$e->getMessage()); |
|
1169 | 1169 | } |
1170 | 1170 | } |
1171 | 1171 | |
@@ -1178,8 +1178,8 @@ discard block |
||
1178 | 1178 | */ |
1179 | 1179 | protected function modelFactory($model, $name, $times = 1) |
1180 | 1180 | { |
1181 | - if (! function_exists('factory')) { |
|
1182 | - throw new ModuleException($this, 'The factory() method does not exist. ' . |
|
1181 | + if (!function_exists('factory')) { |
|
1182 | + throw new ModuleException($this, 'The factory() method does not exist. '. |
|
1183 | 1183 | 'This functionality relies on Laravel model factories, which were introduced in Laravel 5.1.'); |
1184 | 1184 | } |
1185 | 1185 | |
@@ -1213,7 +1213,7 @@ discard block |
||
1213 | 1213 | $server = ReflectionHelper::readPrivateProperty($this->client, 'server'); |
1214 | 1214 | $domain = $server['HTTP_HOST']; |
1215 | 1215 | |
1216 | - return '/^' . str_replace('.', '\.', $domain) . '$/'; |
|
1216 | + return '/^'.str_replace('.', '\.', $domain).'$/'; |
|
1217 | 1217 | } |
1218 | 1218 | |
1219 | 1219 | /** |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | return $this->loadDotEnvFile(); |
45 | 45 | } |
46 | 46 | } catch (\Exception $e) { |
47 | - throw new ConfigurationException("Failed loading params from $paramStorage\n" . $e->getMessage()); |
|
47 | + throw new ConfigurationException("Failed loading params from $paramStorage\n".$e->getMessage()); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | throw new ConfigurationException("Params can't be loaded from `$paramStorage`."); |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | } |
88 | 88 | |
89 | 89 | throw new ConfigurationException( |
90 | - "`vlucas/phpdotenv` library is required to parse .env files.\n" . |
|
90 | + "`vlucas/phpdotenv` library is required to parse .env files.\n". |
|
91 | 91 | "Please install it via composer: composer require vlucas/phpdotenv" |
92 | 92 | ); |
93 | 93 | } |
@@ -3,7 +3,6 @@ |
||
3 | 3 | |
4 | 4 | use Codeception\Codecept; |
5 | 5 | use Codeception\Configuration; |
6 | -use Codeception\Util\PathResolver; |
|
7 | 6 | use Symfony\Component\Console\Command\Command; |
8 | 7 | use Symfony\Component\Console\Input\InputArgument; |
9 | 8 | use Symfony\Component\Console\Input\InputInterface; |
@@ -121,8 +121,8 @@ discard block |
||
121 | 121 | $this->setDefinition([ |
122 | 122 | new InputArgument('suite', InputArgument::OPTIONAL, 'suite to be tested'), |
123 | 123 | new InputArgument('test', InputArgument::OPTIONAL, 'test to be run'), |
124 | - new InputOption('override', 'o', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Override config values'), |
|
125 | - new InputOption('ext', 'e', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Run with extension enabled'), |
|
124 | + new InputOption('override', 'o', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Override config values'), |
|
125 | + new InputOption('ext', 'e', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Run with extension enabled'), |
|
126 | 126 | new InputOption('report', '', InputOption::VALUE_NONE, 'Show output in compact style'), |
127 | 127 | new InputOption('html', '', InputOption::VALUE_OPTIONAL, 'Generate html with results', 'report.html'), |
128 | 128 | new InputOption('xml', '', InputOption::VALUE_OPTIONAL, 'Generate JUnit XML Log', 'report.xml'), |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | } |
242 | 242 | if (!$this->options['silent']) { |
243 | 243 | $this->output->writeln( |
244 | - Codecept::versionString() . "\nPowered by " . \PHPUnit\Runner\Version::getVersionString() |
|
244 | + Codecept::versionString()."\nPowered by ".\PHPUnit\Runner\Version::getVersionString() |
|
245 | 245 | ); |
246 | 246 | } |
247 | 247 | if ($this->options['debug']) { |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | ); |
316 | 316 | } |
317 | 317 | |
318 | - $testsPath = $include . DIRECTORY_SEPARATOR. $config['paths']['tests']; |
|
318 | + $testsPath = $include.DIRECTORY_SEPARATOR.$config['paths']['tests']; |
|
319 | 319 | |
320 | 320 | try { |
321 | 321 | list(, $suite, $test) = $this->matchTestFromFilename($suite, $testsPath); |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | // Workaround when codeception.yml is inside tests directory and tests path is set to "." |
388 | 388 | // @see https://github.com/Codeception/Codeception/issues/4432 |
389 | 389 | if ($config['paths']['tests'] === '.' && !preg_match('~^\.[/\\\]~', $suite)) { |
390 | - $suite = './' . $suite; |
|
390 | + $suite = './'.$suite; |
|
391 | 391 | } |
392 | 392 | |
393 | 393 | // running a single test when suite has a configured path |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | if (!isset($suiteConfig['path'])) { |
397 | 397 | continue; |
398 | 398 | } |
399 | - $testsPath = $config['paths']['tests'] . DIRECTORY_SEPARATOR . $suiteConfig['path']; |
|
399 | + $testsPath = $config['paths']['tests'].DIRECTORY_SEPARATOR.$suiteConfig['path']; |
|
400 | 400 | if ($suiteConfig['path'] === '.') { |
401 | 401 | $testsPath = $config['paths']['tests']; |
402 | 402 | } |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | } |
410 | 410 | |
411 | 411 | // Run single test without included tests |
412 | - if (! Configuration::isEmpty() && strpos($suite, $config['paths']['tests']) === 0) { |
|
412 | + if (!Configuration::isEmpty() && strpos($suite, $config['paths']['tests']) === 0) { |
|
413 | 413 | return $this->matchTestFromFilename($suite, $config['paths']['tests']); |
414 | 414 | } |
415 | 415 | } |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | protected function runIncludedSuites($suites, $parent_dir) |
424 | 424 | { |
425 | 425 | foreach ($suites as $relativePath) { |
426 | - $current_dir = rtrim($parent_dir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $relativePath; |
|
426 | + $current_dir = rtrim($parent_dir, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.$relativePath; |
|
427 | 427 | $config = Configuration::config($current_dir); |
428 | 428 | $suites = Configuration::suites(); |
429 | 429 |