Add opening PHP tags for new examples

This commit is contained in:
Oliver Davies 2020-11-13 23:53:13 +00:00
parent e1e137f55e
commit 1baead38fd

View file

@ -338,6 +338,8 @@ Again, as this functionality is provided by Drupal core by default, this should
Lets start by building a blog page. This will look very similar to the admin page tests, but instead well be testing the `/blog` page. Lets start by building a blog page. This will look very similar to the admin page tests, but instead well be testing the `/blog` page.
```php ```php
<?php
// tests/src/Functional/BlogPageTest.php // tests/src/Functional/BlogPageTest.php
namespace Drupal\my_module\Functional; namespace Drupal\my_module\Functional;
@ -421,6 +423,8 @@ mkdir src/Controller
Lets start by creating a minimal controller, that returns an empty render array. Because we didnt specify a method to use within the route file, we use PHPs `__invoke()` method. Lets start by creating a minimal controller, that returns an empty render array. Because we didnt specify a method to use within the route file, we use PHPs `__invoke()` method.
```php ```php
<?php
// src/Controller/BlogPageController // src/Controller/BlogPageController
namespace Drupal\my_module\Controller; namespace Drupal\my_module\Controller;
@ -504,6 +508,8 @@ mkdir tests/src/Kernel
And an `ArticleRepositoryTest` class. And an `ArticleRepositoryTest` class.
```php ```php
<?php
// tests/src/Kernel/ArticleRepositoryTest.php // tests/src/Kernel/ArticleRepositoryTest.php
namespace Drupal\Tests\my_module\Kernel; namespace Drupal\Tests\my_module\Kernel;
@ -569,6 +575,8 @@ mkdir src/Repository
To begin with, lets create a basic `ArticleRepository` class. To begin with, lets create a basic `ArticleRepository` class.
```php ```php
<?php
// my_module/src/Repository/ArticleRepository // my_module/src/Repository/ArticleRepository
namespace Drupal\my_module\Repository; namespace Drupal\my_module\Repository;