Check all test support files with PHPStan

[MAILPOET-2429]
This commit is contained in:
Jan Jakeš
2019-10-17 13:12:26 +02:00
committed by Jack Kitterhing
parent a2982de3a8
commit e3176a3edf
4 changed files with 10 additions and 2 deletions

View File

@@ -474,6 +474,7 @@ class RoboFile extends \Robo\Tasks {
->rawArg('--configuration=phpstan-tests.neon')
->rawArg(
implode(' ', [
"$dir/tests/_support",
"$dir/tests/DataFactories",
"$dir/tests/acceptance",
"$dir/tests/unit",

View File

@@ -8,6 +8,7 @@ parameters:
- %mailpoetDir%/vendor/codeception/verify/src/Codeception/function.php
- %mailpoetDir%/vendor/codeception/verify/src/Codeception/Verify.php
autoload_directories:
- %mailpoetDir%/tests/_support/_generated # without this line PHPStan segfaults ¯\_(ツ)_/¯
- %mailpoetDir%/tests/_support
- %mailpoetDir%/tests/acceptance
- %mailpoetDir%/tests/unit
@@ -15,6 +16,8 @@ parameters:
- WP_DEBUG
ignoreErrors:
- '/Parameter #1 $cssOrXPath of method AcceptanceTester::moveMouseOver() expects string|null, array<string, string> given./'
excludes_analyse:
- %mailpoetDir%/tests/_support/_generated
includes:
- vendor/phpstan/phpstan-phpunit/extension.neon

View File

@@ -1,6 +1,6 @@
<?php
use Mailpoet\Models\Form as FormModel;
use MailPoet\Models\Form as FormModel;
use MailPoet\Test\DataFactories\Form;
use MailPoet\Test\DataFactories\Segment;
use MailPoet\Test\DataFactories\Subscriber;

View File

@@ -2,6 +2,7 @@
namespace Helper;
use Codeception\Module\WebDriver;
use Codeception\TestInterface;
// here you can define custom actions
@@ -18,6 +19,7 @@ class Acceptance extends \Codeception\Module
*/
function seeNoJSErrors() {
$wd = $this->getModule('WPWebDriver');
assert($wd instanceof WebDriver);
try {
$logEntries = array_slice(
@@ -45,7 +47,9 @@ class Acceptance extends \Codeception\Module
}
function getCurrentUrl() {
return $this->getModule('WPWebDriver')->_getCurrentUri();
$wd = $this->getModule('WPWebDriver');
assert($wd instanceof WebDriver);
return $wd->_getCurrentUri();
}
protected function isJSError($logEntry) {