Skip to main content
[2020-09-06]

My PHPUnit configuration for my Drupal projects

#drupal #phpunit

The other week, I was asked about how I maintain my PHPUnit config file for my Drupal projects. When running Drupal's PHPUnit test suites, you typically copy and modify the distribution phpunit.xml.dist file which lives in the web/core subdirectory. There is just one problem.

[2020-06-04]

Boost your test writing productivity with PHPUnit for PhpStorm

#phpstorm #phpunit #drupal

I write a lot of tests for all of my Drupal code. I try to live by Test Driven Development. It delivers cleaner code. It helps define your architecture without full implementation details. I also despise clicking and manually testing things.

[2018-10-12]

Running Drupal's PHPUnit test suites on DDEV

#ddev #drupal #phpunit #testing

DDEV is a local development stack built on top of Docker. It gives you all of your environment needs without messy configured on your host machine, without needing to know Docker or configure your own containers. Which is great, and makes life easier. Instead of just using DDEV to develop your site or application locally, why not also run your tests within it?

[2018-10-06]

Test driven development in PhpStorm with auto-testing enabled

#phpunit #testing #test-driven development #phpstorm #drupal

When I work, I try to follow the principles of Test-Driven Development. I have found it to aid me in writing cleaner code, identifying odd coupling of components or crazy accidental dependencies between components. It also lets me write my API first by using mocks against interfaces I have defined.

[2016-05-23]

Run \Drupal\Tests\BrowserTestBase with SQLite

#drupal #phpunit #testing

As part of the push to deprecate SimpleTest and use PHPUnit as the test runner in Drupal 8, there is the \Drupal\Tests\BrowserTestBase class. The BrowserTestBase provides a Mink runner that tests web pages in Drupal. Unlike kernel tests, which require a database and can be run via PHPUnit as well, browser tests use your default database connection.