Skip to content
Snippets Groups Projects
Commit f03e93cb authored by Dries Buytaert's avatar Dries Buytaert
Browse files

Issue #2254183 by sun, tim.plunkett: Fix test performance of Drupal\filter\Tests\FilterAdminTest.

parent 4e451f65
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -16,12 +16,13 @@ ...@@ -16,12 +16,13 @@
class FilterAdminTest extends WebTestBase { class FilterAdminTest extends WebTestBase {
/** /**
* The installation profile to use with this test. * {@inheritdoc}
*
* @var string
*/ */
protected $profile = 'standard'; public static $modules = array('filter', 'node');
/**
* {@inheritdoc}
*/
public static function getInfo() { public static function getInfo() {
return array( return array(
'name' => 'Filter administration functionality', 'name' => 'Filter administration functionality',
...@@ -30,13 +31,62 @@ public static function getInfo() { ...@@ -30,13 +31,62 @@ public static function getInfo() {
); );
} }
/**
* {@inheritdoc}
*/
function setUp() { function setUp() {
parent::setUp(); parent::setUp();
// Create users. $this->drupalCreateContentType(array('type' => 'page', 'name' => 'Basic page'));
$basic_html_format = entity_load('filter_format', 'basic_html');
$restricted_html_format = entity_load('filter_format', 'restricted_html'); // Set up the filter formats used by this test.
$full_html_format = entity_load('filter_format', 'full_html'); $basic_html_format = entity_create('filter_format', array(
'format' => 'basic_html',
'name' => 'Basic HTML',
'filters' => array(
'filter_html' => array(
'status' => 1,
'settings' => array(
'allowed_html' => '<p> <br> <strong> <a> <em>',
),
),
),
));
$basic_html_format->save();
$restricted_html_format = entity_create('filter_format', array(
'format' => 'restricted_html',
'name' => 'Restricted HTML',
'filters' => array(
'filter_html' => array(
'status' => TRUE,
'weight' => -10,
'settings' => array(
'allowed_html' => '<p> <br> <strong> <a> <em> <h4>',
),
),
'filter_autop' => array(
'status' => TRUE,
'weight' => 0,
),
'filter_url' => array(
'status' => TRUE,
'weight' => 0,
),
'filter_htmlcorrector' => array(
'status' => TRUE,
'weight' => 10,
),
),
));
$restricted_html_format->save();
$full_html_format = entity_create('filter_format', array(
'format' => 'full_html',
'name' => 'Full HTML',
'weight' => 1,
'filters' => array(),
));
$full_html_format->save();
$this->admin_user = $this->drupalCreateUser(array( $this->admin_user = $this->drupalCreateUser(array(
'administer filters', 'administer filters',
$basic_html_format->getPermissionName(), $basic_html_format->getPermissionName(),
...@@ -45,6 +95,8 @@ function setUp() { ...@@ -45,6 +95,8 @@ function setUp() {
)); ));
$this->web_user = $this->drupalCreateUser(array('create page content', 'edit own page content')); $this->web_user = $this->drupalCreateUser(array('create page content', 'edit own page content'));
user_role_grant_permissions('authenticated', array($basic_html_format->getPermissionName()));
user_role_grant_permissions('anonymous', array($restricted_html_format->getPermissionName()));
$this->drupalLogin($this->admin_user); $this->drupalLogin($this->admin_user);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment