Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

SitePoint PHP Blog:
Automated Testing of Drupal 8 Modules
May 04, 2015 @ 16:06:08

The SitePoint PHP blog has a tutorial posted talking about the automated testing of Drupal 8 modules, the components of the popular PHP-based content management system. In it author Daniel Sipos shows how to create a few tests for some functionality created in previous articles.

In this article we are going to look at automated testing in Drupal 8. More specifically, we are going to write a few integration tests for some of the business logic we wrote in the previous Sitepoint articles on Drupal 8 module development. [...] But before doing that, we will talk a bit about what kinds of tests we can write in Drupal 8 and how they actually work.

He makes use of the SimpleTest unit testing tool for PHP (versus something like PHPUnit) as it has become a standard for Drupal's own testing. He talks briefly about what SimpleTest is, how it integrates with Drupal and what kinds of tests already exist. He then gets into testing his own functionality - checking route information, that the page exists, the contents of the resulting page and the addition of a custom block plugin. He shows how to create these simple tests, extending the WebTestBase class, and checking each item on the list. He also includes an example of the resulting output of the successful testing, including time to execute and the detailed results of each test.

tagged: drupal8 automated testing tutorial simpletest introduction exists form custom plugin

Link: http://www.sitepoint.com/automated-testing-drupal-8-modules/


Trending Topics: