Commit 7e9d2c16 authored by webchick's avatar webchick

Issue #1711070 by kid_icarus, tim.plunkett, xjm, droplet, zendoodles and...

Issue #1711070 by kid_icarus, tim.plunkett, xjm, droplet, zendoodles and cam8001: Convert tests to use ::$modules property instead of parent::setUp($modules).
parent 7e571b97
......@@ -13,8 +13,16 @@
* Defines a base class for testing aggregator.module.
*/
abstract class AggregatorTestBase extends WebTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array('node', 'block', 'aggregator', 'aggregator_test');
function setUp() {
parent::setUp(array('node', 'block', 'aggregator', 'aggregator_test'));
parent::setUp();
// Create an Article node type.
if ($this->profile != 'standard') {
......
......@@ -13,6 +13,14 @@
* Test the block system with admin themes.
*/
class BlockAdminThemeTest extends WebTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array('block');
public static function getInfo() {
return array(
'name' => 'Admin theme block admin accessibility',
......@@ -21,10 +29,6 @@ public static function getInfo() {
);
}
function setUp() {
parent::setUp(array('block'));
}
/**
* Check for the accessibility of the admin theme on the block admin page.
*/
......
......@@ -13,6 +13,14 @@
* Test block caching.
*/
class BlockCacheTest extends WebTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array('block', 'block_test');
protected $admin_user;
protected $normal_user;
protected $normal_user_alt;
......@@ -26,7 +34,7 @@ public static function getInfo() {
}
function setUp() {
parent::setUp(array('block', 'block_test'));
parent::setUp();
// Create an admin user, log in and enable test blocks.
$this->admin_user = $this->drupalCreateUser(array('administer blocks', 'access administration pages'));
......
......@@ -13,6 +13,14 @@
* Tests that hidden regions do not inherit blocks when a theme is enabled.
*/
class BlockHiddenRegionTest extends WebTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array('block', 'block_test', 'search');
public static function getInfo() {
return array(
'name' => 'Blocks not in hidden region',
......@@ -22,7 +30,7 @@ public static function getInfo() {
}
function setUp() {
parent::setUp(array('block', 'block_test', 'search'));
parent::setUp();
// Enable Search block in default theme.
db_merge('block')
......
......@@ -14,6 +14,13 @@
*/
class BlockHtmlIdTest extends WebTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array('block', 'block_test');
public static function getInfo() {
return array(
'name' => 'Block HTML id',
......@@ -23,7 +30,7 @@ public static function getInfo() {
}
function setUp() {
parent::setUp(array('block', 'block_test'));
parent::setUp();
// Create an admin user, log in and enable test blocks.
$this->admin_user = $this->drupalCreateUser(array('administer blocks', 'access administration pages'));
......
......@@ -13,6 +13,14 @@
* Tests that a block assigned to an invalid region triggers the warning.
*/
class BlockInvalidRegionTest extends WebTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array('block', 'block_test');
public static function getInfo() {
return array(
'name' => 'Blocks in invalid regions',
......@@ -22,7 +30,7 @@ public static function getInfo() {
}
function setUp() {
parent::setUp(array('block', 'block_test'));
parent::setUp();
// Create an admin user.
$admin_user = $this->drupalCreateUser(array('administer site configuration', 'access administration pages'));
$this->drupalLogin($admin_user);
......
......@@ -13,6 +13,14 @@
* Functional tests for the language list configuration forms.
*/
class BlockLanguageTest extends WebTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array('language', 'block');
public static function getInfo() {
return array(
'name' => 'Language block visibility',
......@@ -21,10 +29,6 @@ public static function getInfo() {
);
}
function setUp() {
parent::setUp('language', 'block');
}
/**
* Tests the visibility settings for the blocks based on language.
*/
......
......@@ -10,6 +10,14 @@
use Drupal\simpletest\WebTestBase;
class BlockTest extends WebTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array('block');
protected $regions;
protected $admin_user;
......@@ -22,7 +30,7 @@ public static function getInfo() {
}
function setUp() {
parent::setUp(array('block'));
parent::setUp();
// Create Full HTML text format.
$full_html_format = array(
......
......@@ -13,6 +13,14 @@
* Tests personalized block settings for user accounts.
*/
class BlockUserAccountSettingsTest extends WebTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array('block', 'field_ui');
public static function getInfo() {
return array(
'name' => 'Personalized block settings',
......@@ -22,7 +30,7 @@ public static function getInfo() {
}
public function setUp() {
parent::setUp(array('block', 'field_ui'));
parent::setUp();
$admin_user = $this->drupalCreateUser(array('administer users'));
$this->drupalLogin($admin_user);
}
......
......@@ -13,6 +13,14 @@
* Test blocks correctly initialized when picking a new default theme.
*/
class NewDefaultThemeBlocksTest extends WebTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array('block');
public static function getInfo() {
return array(
'name' => 'New default theme blocks',
......@@ -21,10 +29,6 @@ public static function getInfo() {
);
}
function setUp() {
parent::setUp(array('block'));
}
/**
* Check the enabled Bartik blocks are correctly copied over.
*/
......
......@@ -10,6 +10,14 @@
use Drupal\simpletest\WebTestBase;
class NonDefaultBlockAdminTest extends WebTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array('block');
public static function getInfo() {
return array(
'name' => 'Non default theme admin',
......@@ -18,10 +26,6 @@ public static function getInfo() {
);
}
function setUp() {
parent::setUp(array('block'));
}
/**
* Test non-default theme admin.
*/
......
......@@ -11,6 +11,14 @@
use Drupal\simpletest\WebTestBase;
class BookTest extends WebTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array('book', 'block', 'node_access_test');
protected $book;
// $book_author is a user with permission to create and edit books.
protected $book_author;
......@@ -29,7 +37,7 @@ public static function getInfo() {
}
function setUp() {
parent::setUp(array('book', 'block', 'node_access_test'));
parent::setUp();
// node_access_test requires a node_access_rebuild().
node_access_rebuild();
......
......@@ -13,6 +13,14 @@
* Tests the Color module functionality.
*/
class ColorTest extends WebTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array('color');
protected $big_user;
protected $themes;
protected $colorTests;
......@@ -26,7 +34,7 @@ public static function getInfo() {
}
function setUp() {
parent::setUp('color');
parent::setUp();
// Create users.
$this->big_user = $this->drupalCreateUser(array('administer themes'));
......
......@@ -17,6 +17,14 @@
* access module is in use.
*/
class CommentNodeAccessTest extends CommentTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array('node_access_test');
public static function getInfo() {
return array(
'name' => 'Comment node access',
......@@ -26,13 +34,12 @@ public static function getInfo() {
}
function setUp() {
WebTestBase::setUp('comment', 'search', 'node_access_test');
parent::setUp();
node_access_rebuild();
// Create users and test node.
$this->admin_user = $this->drupalCreateUser(array('administer content types', 'administer comments', 'administer blocks'));
// Re-create user.
$this->web_user = $this->drupalCreateUser(array('access comments', 'post comments', 'create article content', 'edit own comments', 'node test view'));
$this->node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'uid' => $this->web_user->uid));
}
/**
......
......@@ -11,6 +11,14 @@
use Drupal\simpletest\WebTestBase;
abstract class CommentTestBase extends WebTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array('comment', 'search');
protected $profile = 'standard';
protected $admin_user;
......@@ -18,7 +26,8 @@ abstract class CommentTestBase extends WebTestBase {
protected $node;
function setUp() {
parent::setUp('comment', 'search');
parent::setUp();
// Create users and test node.
$this->admin_user = $this->drupalCreateUser(array('administer content types', 'administer comments', 'administer blocks'));
$this->web_user = $this->drupalCreateUser(array('access comments', 'post comments', 'create article content', 'edit own comments'));
......
......@@ -15,6 +15,14 @@
* Tests importing configuration from files into active store.
*/
class ConfigImportTest extends WebTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array('config_test');
public static function getInfo() {
return array(
'name' => 'Import configuration',
......@@ -23,10 +31,6 @@ public static function getInfo() {
);
}
function setUp() {
parent::setUp(array('config_test'));
}
/**
* Tests deletion of configuration during import.
*/
......
......@@ -14,6 +14,14 @@
* Tests migration of variables into configuration objects.
*/
class ConfigUpgradeTest extends WebTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array('config_upgrade');
protected $testContent = 'Olá, Sao Paulo!';
public static function getInfo() {
......@@ -25,7 +33,7 @@ public static function getInfo() {
}
function setUp() {
parent::setUp('config_upgrade');
parent::setUp();
require_once DRUPAL_ROOT . '/core/includes/update.inc';
}
......
......@@ -14,6 +14,13 @@
*/
class ContactAuthenticatedUserTest extends WebTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array('contact');
public static function getInfo() {
return array(
'name' => 'Contact form textfields',
......@@ -22,10 +29,6 @@ public static function getInfo() {
);
}
function setUp() {
parent::setUp(array('contact'));
}
/**
* Tests that name and email fields are not present for authenticated users.
*/
......
......@@ -13,6 +13,14 @@
* Tests the personal contact form.
*/
class ContactPersonalTest extends WebTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array('contact');
private $admin_user;
private $web_user;
private $contact_user;
......@@ -26,7 +34,7 @@ public static function getInfo() {
}
function setUp() {
parent::setUp('contact');
parent::setUp();
// Create an admin user.
$this->admin_user = $this->drupalCreateUser(array('administer contact forms', 'administer users'));
......
......@@ -13,6 +13,14 @@
* Tests the site-wide contact form.
*/
class ContactSitewideTest extends WebTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array('contact');
public static function getInfo() {
return array(
'name' => 'Site-wide contact form',
......@@ -21,10 +29,6 @@ public static function getInfo() {
);
}
function setUp() {
parent::setUp('contact');
}
/**
* Tests configuration options and the site-wide contact form.
*/
......
......@@ -13,6 +13,14 @@
* Tests accessible links after inaccessible links on dynamic context.
*/
class ContextualDynamicContextTest extends WebTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array('contextual', 'node');
public static function getInfo() {
return array(
'name' => 'Contextual links on node lists',
......@@ -22,7 +30,7 @@ public static function getInfo() {
}
function setUp() {
parent::setUp(array('contextual', 'node'));
parent::setUp();
$this->drupalCreateContentType(array('type' => 'page', 'name' => 'Basic page'));
$this->drupalCreateContentType(array('type' => 'article', 'name' => 'Article'));
$web_user = $this->drupalCreateUser(array('access content', 'access contextual links', 'edit any article content'));
......
......@@ -11,6 +11,14 @@
use SimpleXMLElement;
class DBLogTest extends WebTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array('dblog', 'poll');
protected $profile = 'standard';
protected $big_user;
......@@ -24,12 +32,10 @@ public static function getInfo() {
);
}
/**
* Enable modules and create users with specific permissions.
*/
function setUp() {
parent::setUp('dblog', 'poll');
// Create users.
parent::setUp();
// Create users with specific permissions.
$this->big_user = $this->drupalCreateUser(array('administer site configuration', 'access administration pages', 'access site reports', 'administer users'));
$this->any_user = $this->drupalCreateUser(array());
}
......
......@@ -14,6 +14,13 @@
*/
class EntityApiTest extends WebTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array('entity', 'entity_test');
public static function getInfo() {
return array(
'name' => 'Entity CRUD',
......@@ -22,10 +29,6 @@ public static function getInfo() {
);
}
function setUp() {
parent::setUp('entity', 'entity_test');
}
/**
* Tests basic CRUD functionality of the Entity API.
*/
......
......@@ -23,6 +23,13 @@
*/
class EntityCrudHookTest extends WebTestBase {
/**
* Modules to enable.
*
* @var array