-
Notifications
You must be signed in to change notification settings - Fork 118
Expand file tree
/
Copy pathRulesWebProfilerTest.php
More file actions
76 lines (63 loc) · 1.76 KB
/
RulesWebProfilerTest.php
File metadata and controls
76 lines (63 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
/**
* @file
* Contains \Drupal\rules\Tests\RulesWebProfilerTest
*/
namespace Drupal\rules\Tests;
/**
* Class RulesWebProfilerTest
*
* Tests integration Rules logging with WebProfiler module.
*
* @group rules
*/
class RulesWebProfilerTest extends RulesDrupalWebTestBase {
/**
* Authenticated user with access to WebProfiler.
*
* @var \Drupal\user\Entity\User
*/
protected $webProfilerUser;
public static $modules = ['rules', 'webprofiler', 'block'];
/**
* {@inheritdoc}
*/
public function setUp() {
parent::setup();
// Enable rules logging.
$this->container->get('config.factory')
->getEditable('rules.settings')
->set('debug_log', 1)
->set('log_errors', 'debug')
->save();
$this->webProfilerUser = $this->drupalCreateUser(array(
'access webprofiler',
'view webprofiler toolbar',
));
// Enables rules web debugging with WebProfiler.
$this->container->get('config.factory')
->getEditable('webprofiler.config')
->set('active_toolbar_items.rules', 'rules')
->save();
$this->drupalLogin($this->webProfilerUser);
}
/**
* Goes to WebProfiler page using link from toolbar and check entries there.
*/
public function testWebProfilerPage() {
$this->drupalGet('404', [
'query' => [
'log' => '1',
'log-level' => 'critical',
'log-message' => 'critical message',
'log-amount' => 5,
],
]);
$this->drupalGet('admin/reports/profiler/list');
$links = $this->xpath('//main//table[1]//a');
$url = $this->getAbsoluteUrl($links[0]['href']);
$this->drupalGet($url);
$this->assertText('Rules logs', 'Rules logs table exists');
$this->assertText('critical message', 'Rules log entry exists');
}
}