function ConfigureAndExecuteTest::setUp

Overrides BrowserTestBase::setUp

File

tests/src/Functional/ConfigureAndExecuteTest.php, line 51

Class

ConfigureAndExecuteTest
Tests that a rule can be configured and triggered when a node is edited.

Namespace

Drupal\Tests\rules\Functional

Code

protected function setUp() : void {
  parent::setUp();
  $this->storage = $this->container
    ->get('entity_type.manager')
    ->getStorage('rules_reaction_rule');
  $this->expressionManager = $this->container
    ->get('plugin.manager.rules_expression');
  // Create an article content type that we will use for testing.
  $type = $this->container
    ->get('entity_type.manager')
    ->getStorage('node_type')
    ->create([
    'type' => 'article',
    'name' => 'Article',
  ]);
  $type->save();
  // Create the user with all needed permissions.
  $this->account = $this->drupalCreateUser([
    'create article content',
    'edit any article content',
    'administer rules',
    'administer site configuration',
  ]);
  $this->drupalLogin($this->account);
  // Create a named role for use in conditions and actions.
  $this->createRole([
    'administer nodes',
  ], 'test-editor', 'Test Editor');
}