RulesDebugLogTest.php in Rules 8.3
File
tests/src/Functional/RulesDebugLogTest.php
View source
<?php
namespace Drupal\Tests\rules\Functional;
class RulesDebugLogTest extends RulesBrowserTestBase {
protected static $modules = [
'rules',
'rules_test',
];
protected $profile = 'minimal';
protected function setUp() : void {
parent::setUp();
$this
->createContentType([
'type' => 'page',
'name' => 'Basic page',
]);
$this
->config('rules.settings')
->set('debug_log.enabled', TRUE)
->set('debug_log.log_level', 'debug')
->save();
}
public function testEventDebugLogMessage() {
$account = $this
->createUser([
'administer rules',
'access rules debug',
'create page content',
]);
$this
->drupalLogin($account);
$this
->drupalGet('admin/config/workflow/rules');
$this
->clickLink('Add reaction rule');
$this
->fillField('Label', 'Test rule');
$this
->fillField('Machine-readable name', 'test_rule');
$this
->fillField('React on event', 'rules_entity_insert:node');
$this
->pressButton('Save');
$this
->drupalGet('node/add/page');
$this
->fillField('Title', 'Test page');
$this
->pressButton('Save');
$assert = $this
->assertSession();
$assert
->pageTextContainsOnce('0 ms Reacting on event After saving a new content item.');
}
}