Add example module with a deprecation
This commit is contained in:
parent
e414469ca0
commit
c3b71960f5
7
web/modules/custom/example/example.info.yml
Normal file
7
web/modules/custom/example/example.info.yml
Normal file
|
@ -0,0 +1,7 @@
|
|||
name: Example module
|
||||
description: An example module.
|
||||
type: module
|
||||
core_version_requirement: ^8 || ^9
|
||||
dependencies:
|
||||
- drupal:filter
|
||||
- drupal:node
|
17
web/modules/custom/example/example.module
Normal file
17
web/modules/custom/example/example.module
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* An example module.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use Drupal\Core\Entity\EntityInterface;
|
||||
|
||||
/**
|
||||
* Implements hook_entity_view().
|
||||
*/
|
||||
function example_entity_view(array &$build, EntityInterface $entity): void {
|
||||
drupal_set_message(t('This is a node.'));
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\example\Functional;
|
||||
|
||||
use Drupal\Tests\BrowserTestBase;
|
||||
|
||||
class DisplayMessageTest extends BrowserTestBase {
|
||||
|
||||
protected $defaultTheme = 'stable';
|
||||
|
||||
protected static $modules = ['filter', 'node', 'example'];
|
||||
|
||||
/** @test */
|
||||
public function a_message_is_displayed_on_nodes(): void {
|
||||
$this->drupalCreateContentType(['type' => 'page']);
|
||||
|
||||
$this->drupalCreateNode();
|
||||
|
||||
$this->drupalGet('node/1');
|
||||
|
||||
$this->assertText('This is a node.');
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in a new issue