March 2019
Intermediate to advanced
580 pages
15h 3m
English
Now that we have that covered, it's time to write our first Kernel test. And a nice simple example can be to test the TeamCleanerQueueWorker plugin we created in Chapter 14, Batches, Queues, and Cron. If you are wondering why this cannot be tested using the ultra-fast unit testing methodology, the answer is that its single method doesn't return anything. Instead, it alters database values that we need to access in order to check it happened correctly.
The test class goes naturally in the tests/src/Kernel folder of our module and can start off like this:
namespace Drupal\Tests\sports\Kernel; use Drupal\KernelTests\KernelTestBase; /** * Test the TeamCleaner QueueWorker plugin. * * @group sports */ class TeamCleanerTest extends ...
Read now
Unlock full access