You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
1.8 KiB
67 lines
1.8 KiB
4 years ago
|
<?php
|
||
|
|
||
|
/**
|
||
|
* @file
|
||
|
* Rules UI tests.
|
||
|
*/
|
||
|
|
||
|
/**
|
||
|
* UI test cases for the minimal profile.
|
||
|
*
|
||
|
* The minimal profile is useful for testing because it has fewer dependencies
|
||
|
* so the tests run faster. Also, removing the profile-specific configuration
|
||
|
* reveals assumptions in the code. For example, the minimal profile doesn't
|
||
|
* define any content types, so when Rules expects to have content types to
|
||
|
* operate on that assumption may cause errors.
|
||
|
*/
|
||
|
class RulesAdminMinimalProfileTestCase extends DrupalWebTestCase {
|
||
|
|
||
|
/**
|
||
|
* {@inheritdoc}
|
||
|
*/
|
||
|
protected $profile = 'minimal';
|
||
|
|
||
|
/**
|
||
|
* Declares test metadata.
|
||
|
*/
|
||
|
public static function getInfo() {
|
||
|
return array(
|
||
|
'name' => 'Rules UI Minimal Profile Tests ',
|
||
|
'description' => 'Tests UI support for minimal profile.',
|
||
|
'group' => 'Rules',
|
||
|
);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Overrides DrupalWebTestCase::setUp().
|
||
|
*/
|
||
|
protected function setUp() {
|
||
|
parent::setUp('rules', 'rules_admin');
|
||
|
RulesLog::logger()->clear();
|
||
|
variable_set('rules_debug_log', TRUE);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Tests node event UI without content types.
|
||
|
*
|
||
|
* @see https://www.drupal.org/project/rules/issues/2267341
|
||
|
*/
|
||
|
public function testNodeEventUi() {
|
||
|
// Create a simple user account with permission to create a rule.
|
||
|
$user = $this->drupalCreateUser(array('access administration pages', 'administer rules'));
|
||
|
$this->drupalLogin($user);
|
||
|
|
||
|
$this->drupalGet('admin/config/workflow/rules/reaction/add');
|
||
|
$edit = array(
|
||
|
'settings[label]' => 'Test node event',
|
||
|
'settings[name]' => 'test_node_event',
|
||
|
'event' => 'node_insert',
|
||
|
);
|
||
|
$this->drupalPostAJAX(NULL, $edit, 'event');
|
||
|
$this->assertText('Restrict by type', 'Restrict by type selection is visible.');
|
||
|
$this->drupalPost(NULL, $edit, 'Save');
|
||
|
$this->assertText('Editing reaction rule', 'Rule edit page is shown.');
|
||
|
}
|
||
|
|
||
|
}
|