October 2017
Intermediate to advanced
566 pages
14h 31m
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 TeamCleaner QueueWorker 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 one method doesn't return anything. Instead, it alters database values which 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; use Drupal\sports\Plugin\QueueWorker\TeamCleaner; /** * Test the TeamCleaner QueueWorker plugin. ...
Read now
Unlock full access