Hello World page test

The first Functional test we will write is for the Hello World page we created and the functionality behind it. We will test whether the page shows the correct Hello World message, also depending on the value found in the configuration. So let's create the class for it, naturally in the hello_world module, inside the tests/src/Functional folder:

namespace Drupal\Tests\hello_world\Functional; 
 
use Drupal\Tests\BrowserTestBase; 
 
/** 
 * Basic testing of the main Hello World page. 
 * 
 * @group hello_world 
 */ 
class HelloWorldPageTest extends BrowserTestBase {}  

You can really see the consistency with the other types of tests. But in this case, as mentioned, we extend from BrowserTestBase.

Also, like before, we can configure a ...

Get Drupal 8 Module Development - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.