feat: add an example module with custom tests

Add a custom module based on my Drupal module template:

https://github.com/opdavies/drupal-module-template
This commit is contained in:
Oliver Davies 2023-04-21 12:01:22 +01:00
parent ea60b27438
commit 67a9f556c4
10 changed files with 117 additions and 0 deletions
web/modules/custom/example/tests/src
Functional
Kernel
Unit

View file

@ -0,0 +1,31 @@
<?php
namespace Drupal\Tests\example\Functional;
use Drupal\Tests\BrowserTestBase;
use Symfony\Component\HttpFoundation\Response;
final class ExamplePageTest extends BrowserTestBase {
public $defaultTheme = 'stark';
protected static $modules = [
// Core.
'node',
// Custom.
"example"
];
/** @test */
public function should_load_the_example_page_for_anonymous_users(): void {
// Arrange.
// Act.
$this->drupalGet('/@opdavies/drupal-module-template');
// Assert.
$this->assertSession()->statusCodeEquals(Response::HTTP_OK);
}
}