Add opening PHP tags for new examples
This commit is contained in:
parent
e1e137f55e
commit
1baead38fd
|
@ -338,6 +338,8 @@ Again, as this functionality is provided by Drupal core by default, this should
|
||||||
Let’s start by building a blog page. This will look very similar to the admin page tests, but instead we’ll be testing the `/blog` page.
|
Let’s start by building a blog page. This will look very similar to the admin page tests, but instead we’ll 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
|
||||||
Let’s start by creating a minimal controller, that returns an empty render array. Because we didn’t specify a method to use within the route file, we use PHP’s `__invoke()` method.
|
Let’s start by creating a minimal controller, that returns an empty render array. Because we didn’t specify a method to use within the route file, we use PHP’s `__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, let’s create a basic `ArticleRepository` class.
|
To begin with, let’s 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;
|
||||||
|
|
Loading…
Reference in a new issue