Update Drupal configuration files
Signed-off-by: Oliver Davies <oliver@oliverdavies.uk>
This commit is contained in:
parent
7671099aea
commit
96ac446aa5
22 changed files with 309 additions and 14 deletions
3
drupal/web/modules/example/example.info.yml
Normal file
3
drupal/web/modules/example/example.info.yml
Normal file
|
@ -0,0 +1,3 @@
|
|||
name: Example
|
||||
type: module
|
||||
core_version_requirement: ^11
|
7
drupal/web/modules/example/example.routing.yml
Normal file
7
drupal/web/modules/example/example.routing.yml
Normal file
|
@ -0,0 +1,7 @@
|
|||
example.page:
|
||||
path: /example
|
||||
defaults:
|
||||
_controller: Drupal\example\Controller\ExamplePageController
|
||||
methods: [GET]
|
||||
requirements:
|
||||
_permission: access content
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\example\Controller;
|
||||
|
||||
use Drupal\Core\StringTranslation\StringTranslationTrait;
|
||||
|
||||
final class ExamplePageController {
|
||||
|
||||
use StringTranslationTrait;
|
||||
|
||||
public function __invoke(): array {
|
||||
return [
|
||||
'#markup' => $this->t('This page is powered by Drupal and Nix.'),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\example\Functional;
|
||||
|
||||
use Drupal\Tests\BrowserTestBase;
|
||||
|
||||
class ExampleTest extends BrowserTestBase {
|
||||
|
||||
public $defaultTheme = 'stark';
|
||||
|
||||
public static $modules = [
|
||||
'example',
|
||||
'node',
|
||||
];
|
||||
|
||||
public function test_it_loads_the_page(): void {
|
||||
$this->drupalGet('/example');
|
||||
|
||||
$assert = $this->assertSession();
|
||||
|
||||
$assert->statusCodeEquals(200);
|
||||
$assert->pageTextContains('This page is powered by Drupal and Nix.');
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue