Skip to main content
Joachim's blog

Main navigation

  • Home
  • About
  • Hire me

Breadcrumb

  1. Home

tests

By joachim, Wed, 01/04/2026 - 08:14

Speed up your PHPUnit Browser tests with this one trick

It's true, no April fools. You can make your Browser tests run much quicker. How? By deleting them!

You will of course need to add a corresponding Kernel test - and that's the trick. Kernel tests run much faster than Browser tests.

But Browser tests make requests to the test site using an internal web browser, I hear you say, whereas Kernel tests make API calls directly. Kernel tests have their uses for testing APIs, but Browser tests are needed to test actual HTML output.

Tags

  • tests
By joachim, Thu, 19/03/2020 - 14:07

Base fields versus config fields, and how to handle the latter in tests

All fields are equal in Drupal 8! Back in Drupal 7 we had two different systems for data on entities, which worked fairly differently: entity properties that were defined as database fields and controlled by hardcoded form elements, and user-created fields on entities that had widgets and formatters. But now in Drupal 8, every value on an entity is a field, with the same configuration in the UI, access to the widgets and formatters, and whose data is accessed in the same way.

Tags

  • tests
  • Field API
By joachim, Wed, 06/11/2019 - 14:30

Debugging and Logging AJAX requests tests in Docksal

The hardest thing I find with tests is understanding errors. Every time I think I've got debugging output sorted, I find a new layer where it doesn't work, I've got nothing, and I'm in the dark with something that's crashing and I don't know why.

The first layer is simple: errors in your test code itself. For example, make a typo in your tests/src/Functional/MyTest.php and PHPUnit crashes and you see the error in the terminal.

Tags

  • debugging
  • tests
  • drupal planet
tests

Frequent tags

  • Drupal Code Builder (9)
  • git (7)
  • module builder (7)
  • 6.x (5)
  • drupal commerce (4)
  • contributing code (3)
  • development (3)
  • Entity API (3)
  • tests (3)
  • Field API (3)
  • patching (3)
  • Rector (3)
  • Composer (3)
  • Drush (3)
  • maintaining projects (2)
  • code style (2)
  • contrib module (2)
  • drupal.org (2)
  • debugging (2)
  • multisite (2)
  • deprecation (2)
  • issue queue (2)
  • Drupal core (2)
  • core (2)
  • 7.x (2)
  • modules (2)
  • roadmap (2)
  • developer tools (2)
  • wtf (2)
Powered by Drupal