I've test classes based on KernelTestBase
.
Previously everything was working smoothly, now I came back to the project and I'm hit by this error:
Install profile will be a mandatory parameter in Drupal 9.0.
Drupal version: 8.3.5 PHPUnit version: 4.8.35
phpunit.xml:
<phpunit bootstrap="web/core/tests/bootstrap.php" colors="true"
beStrictAboutTestsThatDoNotTestAnything="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutChangesToGlobalState="true"
checkForUnintentionallyCoveredCode="false">
<!-- TODO set printerClass="\Drupal\Tests\Listeners\HtmlOutputPrinter" once
https://youtrack.jetbrains.com/issue/WI-24808 is resolved. Drupal provides a
result printer that links to the html output results for functional tests.
Unfortunately, this breaks the output of PHPStorm's PHPUnit runner. However, if
using the command line you can add
- -printer="\Drupal\Tests\Listeners\HtmlOutputPrinter" to use it (note there
should be no spaces between the hyphens).
-->
<php>
<!-- Set error reporting to E_ALL. -->
<ini name="error_reporting" value="32767"/>
<!-- Do not limit the amount of memory tests take to run. -->
<ini name="memory_limit" value="-1"/>
<!-- Example SIMPLETEST_BASE_URL value: http://localhost -->
<env name="SIMPLETEST_BASE_URL" value=""/>
<!-- Example SIMPLETEST_DB value: mysql://username:password@localhost/databasename#table_prefix -->
<env name="SIMPLETEST_DB" value="mysql://vagrant:vagrant@localhost/vagrant"/>
<!-- Example BROWSERTEST_OUTPUT_DIRECTORY value: /path/to/webroot/sites/simpletest/browser_output -->
<env name="BROWSERTEST_OUTPUT_DIRECTORY" value=""/>
</php>
<testsuites>
<testsuite name="mymod">
<file>web/modules/custom/mymod/tests/src/Kernel/FooTest.php</file>
</testsuite>
<!-- etc -->
</testsuites>
<listeners>
<listener class="\Drupal\Tests\Listeners\DrupalStandardsListener">
</listener>
</listeners>
<!-- Filter for coverage reports. -->
<filter>
<whitelist>
<directory>./web/core/includes</directory>
<directory>./web/core/lib</directory>
<directory>./web/core/modules</directory>
<directory>./web/core/modules</directory>
<directory>./web/core/sites</directory>
<!-- By definition test classes have no tests. -->
<exclude>
<directory suffix="Test.php">./</directory>
<directory suffix="TestBase.php">./</directory>
</exclude>
</whitelist>
</filter>
</phpunit>
Test class:
class FooTest extends KernelTestBase {
protected static $modules = ['foo'];
public function testFoo() {
self::assertEquals(2, 2);
}
}
I'm launching it from PHPStorm via:
vagrant:///Users/drupality/Develop/drupal/myproj/usr/bin/php /home/vagrant/.phpstorm_helpers/phpunit.php --group foo --configuration /var/www/myproj/site/phpunit.xml --filter "/::testFoo( .*)?$/" Drupal\Tests\foo\Kernel\FooTest /var/www/myproj/site/web/modules/custom/myproj/tests/src/Kernel/FooTest.php
UPDATE
I've updated PHPUnit to 5.7.21 (newest supported by PHPStorm) but still no success.
$modules
and$profile
members?