What kind of tests does PHPUnit run in Drupal?

What kind of tests does PHPUnit run in Drupal?

PHPUnit runs all the tests in Drupal 8 and above. Earlier versions of Drupal used the Simpletest Module for testing. If you installed from a Drupal.org package you have three options:

Why are there no tests running in PHPUnit?

Skipped tests are usually an indication that your test environment is missing something, often a database connection. You can get more information about the skipped test by adding the – v parameter to your phpunit command. InvalidArgumentException: There is no database connection so no tests can be run.

Where is the PHPUnit binary located in Drupal?

The relative location of the PHPUnit binary depends on how you install Drupal. If you installed Drupal using a package then run composer update, the vendor directory is within the Drupal root (adjacent to ‘core’). The instructions on this page assume this is your setup.

How to change the PHPUnit tag in Drupal?

In phpunit. xml make the following changes: Set the SIMPLETEST_BASE_URL variable to the URL of your site. Set the SIMPLETEST_DB variable to point to the URL of your Drupal database. If you are placing phpunit. xml somewhere other than core, change the value of the phpunit tag’s ‘bootstrap’ attribute to reflect the new location.

Do you need a web server to run Drupal tests?

For kernel tests, you need a working database connection and for browser tests, your Drupal installation needs to be reachable via a web server. However, you should never install Drupal yourself as the test handles this automatically. Functional tests have to be invoked with a user in the same group as the webserver user.

Can a functional test output plain HTML files?

Functional tests can output the HTML pages that the test running code sees. These are output as plain HTML files. To provide a location for these to be written to, create a directory called sites / simpletest and make sure that it is writable by the webserver. It’s okay to make this directory “world-writable”, i.e.:

Which is the best PHPUnit for automated testing?

It’s recommended to write new tests using the PHPUnit base classes UnitTestCase, KernelTestBase, BrowserTestBase (web tests) or WebDriverTestBase (javascript enabled web tests using WebDriver). We use multiple versions of PHPUnit in the DrupalCI on drupal.org. E.g. on PHP 5.5, 5.6, 7.0 and 7.1 we use PHPUnit 4.8.