diff --git a/core/modules/aggregator/aggregator.module b/core/modules/aggregator/aggregator.module
index bd0c6c1..ff4773f 100644
--- a/core/modules/aggregator/aggregator.module
+++ b/core/modules/aggregator/aggregator.module
@@ -456,10 +456,12 @@ function aggregator_save_category($edit) {
->condition('cid', $edit['cid'])
->execute();
// Make sure there is no active block for this category.
- db_delete('block')
- ->condition('module', 'aggregator')
- ->condition('delta', 'category-' . $edit['cid'])
- ->execute();
+ if (module_exists('block')) {
+ db_delete('block')
+ ->condition('module', 'aggregator')
+ ->condition('delta', 'category-' . $edit['cid'])
+ ->execute();
+ }
$edit['title'] = '';
$op = 'delete';
}
@@ -521,10 +523,12 @@ function aggregator_save_feed($edit) {
->condition('fid', $edit['fid'])
->execute();
// Make sure there is no active block for this feed.
- db_delete('block')
- ->condition('module', 'aggregator')
- ->condition('delta', 'feed-' . $edit['fid'])
- ->execute();
+ if (module_exists('block')) {
+ db_delete('block')
+ ->condition('module', 'aggregator')
+ ->condition('delta', 'feed-' . $edit['fid'])
+ ->execute();
+ }
}
elseif (!empty($edit['title'])) {
$edit['fid'] = db_insert('aggregator_feed')
diff --git a/core/modules/aggregator/aggregator.test b/core/modules/aggregator/aggregator.test
index 522129f..786d9f5 100644
--- a/core/modules/aggregator/aggregator.test
+++ b/core/modules/aggregator/aggregator.test
@@ -7,7 +7,22 @@
class AggregatorTestCase extends DrupalWebTestCase {
function setUp() {
- parent::setUp('aggregator', 'aggregator_test');
+ parent::setUp(array('node', 'block', 'aggregator', 'aggregator_test'));
+
+ // Create an Article node type.
+ $type = array(
+ 'type' => 'article',
+ 'name' => t('Article'),
+ 'base' => 'node_content',
+ 'custom' => 1,
+ 'modified' => 1,
+ 'locked' => 0,
+ );
+ $type = node_type_set_defaults($type);
+ node_type_save($type);
+ node_add_body_field($type);
+ $this->resetAll();
+
$web_user = $this->drupalCreateUser(array('administer news feeds', 'access news feeds', 'create article content'));
$this->drupalLogin($web_user);
}
diff --git a/core/modules/block/block.test b/core/modules/block/block.test
index dbd7dc4..34a02f3 100644
--- a/core/modules/block/block.test
+++ b/core/modules/block/block.test
@@ -6,6 +6,8 @@
*/
class BlockTestCase extends DrupalWebTestCase {
+ protected $profile = 'standard';
+
protected $regions;
protected $admin_user;
@@ -392,14 +394,19 @@ class NonDefaultBlockAdmin extends DrupalWebTestCase {
);
}
+ function setUp() {
+ parent::setUp(array('block'));
+ }
+
/**
* Test non-default theme admin.
*/
function testNonDefaultBlockAdmin() {
$admin_user = $this->drupalCreateUser(array('administer blocks', 'administer themes'));
$this->drupalLogin($admin_user);
- theme_enable(array('stark'));
- $this->drupalGet('admin/structure/block/list/stark');
+ $new_theme = 'bartik';
+ theme_enable(array($new_theme));
+ $this->drupalGet('admin/structure/block/list/' . $new_theme);
}
}
@@ -415,6 +422,10 @@ class NewDefaultThemeBlocks extends DrupalWebTestCase {
);
}
+ function setUp() {
+ parent::setUp(array('block'));
+ }
+
/**
* Check the enabled Bartik blocks are correctly copied over.
*/
@@ -441,11 +452,12 @@ class NewDefaultThemeBlocks extends DrupalWebTestCase {
$blocks[$block->module][$block->delta] = $block;
}
- // Turn on the Stark theme and ensure that it contains all of the blocks
+ // Turn on a new theme and ensure that it contains all of the blocks
// the default theme had.
- theme_enable(array('stark'));
- variable_set('theme_default', 'stark');
- $result = db_query('SELECT * FROM {block} WHERE theme = :theme', array(':theme' => 'stark'));
+ $new_theme = 'bartik';
+ theme_enable(array($new_theme));
+ variable_set('theme_default', $new_theme);
+ $result = db_query('SELECT * FROM {block} WHERE theme = :theme', array(':theme' => $new_theme));
foreach ($result as $block) {
unset($block->theme, $block->bid);
$this->assertEqual($blocks[$block->module][$block->delta], $block, t('Block %name matched', array('%name' => $block->module . '-' . $block->delta)));
@@ -465,6 +477,10 @@ class BlockAdminThemeTestCase extends DrupalWebTestCase {
);
}
+ function setUp() {
+ parent::setUp(array('block'));
+ }
+
/**
* Check for the accessibility of the admin theme on the block admin page.
*/
@@ -474,13 +490,13 @@ class BlockAdminThemeTestCase extends DrupalWebTestCase {
$this->drupalLogin($admin_user);
// Ensure that access to block admin page is denied when theme is disabled.
- $this->drupalGet('admin/structure/block/list/stark');
+ $this->drupalGet('admin/structure/block/list/bartik');
$this->assertResponse(403, t('The block admin page for a disabled theme can not be accessed'));
// Enable admin theme and confirm that tab is accessible.
- $edit['admin_theme'] = 'stark';
+ $edit['admin_theme'] = 'bartik';
$this->drupalPost('admin/appearance', $edit, t('Save configuration'));
- $this->drupalGet('admin/structure/block/list/stark');
+ $this->drupalGet('admin/structure/block/list/bartik');
$this->assertResponse(200, t('The block admin page for the admin theme can be accessed'));
}
}
@@ -502,7 +518,7 @@ class BlockCacheTestCase extends DrupalWebTestCase {
}
function setUp() {
- parent::setUp('block_test');
+ parent::setUp(array('block', 'block_test'));
// Create an admin user, log in and enable test blocks.
$this->admin_user = $this->drupalCreateUser(array('administer blocks', 'access administration pages'));
@@ -686,7 +702,7 @@ class BlockHTMLIdTestCase extends DrupalWebTestCase {
}
function setUp() {
- parent::setUp('block_test');
+ parent::setUp(array('block', 'block_test'));
// Create an admin user, log in and enable test blocks.
$this->admin_user = $this->drupalCreateUser(array('administer blocks', 'access administration pages'));
@@ -769,7 +785,7 @@ class BlockHiddenRegionTestCase extends DrupalWebTestCase {
}
function setUp() {
- parent::setUp(array('block_test'));
+ parent::setUp(array('block', 'block_test'));
}
/**
diff --git a/core/modules/book/book.test b/core/modules/book/book.test
index 6b45742..4c7506e 100644
--- a/core/modules/book/book.test
+++ b/core/modules/book/book.test
@@ -24,7 +24,7 @@ class BookTestCase extends DrupalWebTestCase {
}
function setUp() {
- parent::setUp(array('book', 'node_access_test'));
+ parent::setUp(array('book', 'block', 'node_access_test'));
// node_access_test requires a node_access_rebuild().
node_access_rebuild();
diff --git a/core/modules/comment/comment.test b/core/modules/comment/comment.test
index 2771bc4..5425a3f 100644
--- a/core/modules/comment/comment.test
+++ b/core/modules/comment/comment.test
@@ -6,6 +6,8 @@
*/
class CommentHelperCase extends DrupalWebTestCase {
+ protected $profile = 'standard';
+
protected $admin_user;
protected $web_user;
protected $node;
diff --git a/core/modules/dashboard/dashboard.test b/core/modules/dashboard/dashboard.test
index 7cb93f9..e1bad5e 100644
--- a/core/modules/dashboard/dashboard.test
+++ b/core/modules/dashboard/dashboard.test
@@ -15,21 +15,11 @@ class DashboardBlocksTestCase extends DrupalWebTestCase {
}
function setUp() {
- parent::setUp();
+ parent::setUp(array('block', 'dashboard'));
// Create and log in an administrative user having access to the dashboard.
$admin_user = $this->drupalCreateUser(array('access dashboard', 'administer blocks', 'access administration pages', 'administer modules'));
$this->drupalLogin($admin_user);
-
- // Make sure that the dashboard is using the same theme as the rest of the
- // site (and in particular, the same theme used on 403 pages). This forces
- // the dashboard blocks to be the same for an administrator as for a
- // regular user, and therefore lets us test that the dashboard blocks
- // themselves are specifically removed for a user who does not have access
- // to the dashboard page.
- theme_enable(array('stark'));
- variable_set('theme_default', 'stark');
- variable_set('admin_theme', 'stark');
}
/**
@@ -62,6 +52,7 @@ class DashboardBlocksTestCase extends DrupalWebTestCase {
*/
function testDashboardRegions() {
$dashboard_regions = dashboard_region_descriptions();
+ $this->assertTrue(!empty($dashboard_regions), 'One or more dashboard regions found.');
// Ensure blocks can be placed in dashboard regions.
$this->drupalGet('admin/dashboard/configure');
@@ -111,6 +102,36 @@ class DashboardBlocksTestCase extends DrupalWebTestCase {
$this->drupalGet('admin/dashboard');
$this->assertRaw($custom_block['title'], t('Block still appears on the dashboard.'));
}
+}
+
+class DashboardBlockAvailabilityTestCase extends DrupalWebTestCase {
+ protected $profile = 'standard';
+
+ public static function getInfo() {
+ return array(
+ 'name' => 'Block availability',
+ 'description' => 'Test blocks as used by the dashboard.',
+ 'group' => 'Dashboard',
+ );
+ }
+
+ function setUp() {
+ parent::setUp();
+
+ // Create and log in an administrative user having access to the dashboard.
+ $admin_user = $this->drupalCreateUser(array('access dashboard', 'administer blocks', 'access administration pages', 'administer modules'));
+ $this->drupalLogin($admin_user);
+
+ // Make sure that the dashboard is using the same theme as the rest of the
+ // site (and in particular, the same theme used on 403 pages). This forces
+ // the dashboard blocks to be the same for an administrator as for a
+ // regular user, and therefore lets us test that the dashboard blocks
+ // themselves are specifically removed for a user who does not have access
+ // to the dashboard page.
+ theme_enable(array('stark'));
+ variable_set('theme_default', 'stark');
+ variable_set('admin_theme', 'stark');
+ }
/**
* Test that defining a block with ['properties']['administrative'] = TRUE
diff --git a/core/modules/dblog/dblog.test b/core/modules/dblog/dblog.test
index ffd3e8a..0e1dd21 100644
--- a/core/modules/dblog/dblog.test
+++ b/core/modules/dblog/dblog.test
@@ -6,6 +6,8 @@
*/
class DBLogTestCase extends DrupalWebTestCase {
+ protected $profile = 'standard';
+
protected $big_user;
protected $any_user;
diff --git a/core/modules/field/modules/field_sql_storage/field_sql_storage.test b/core/modules/field/modules/field_sql_storage/field_sql_storage.test
index 773de3d..9c54303 100644
--- a/core/modules/field/modules/field_sql_storage/field_sql_storage.test
+++ b/core/modules/field/modules/field_sql_storage/field_sql_storage.test
@@ -21,7 +21,7 @@ class FieldSqlStorageTestCase extends DrupalWebTestCase {
}
function setUp() {
- parent::setUp('field_sql_storage', 'field', 'field_test', 'text');
+ parent::setUp('field_sql_storage', 'field', 'field_test', 'text', 'number');
$this->field_name = strtolower($this->randomName());
$this->field = array('field_name' => $this->field_name, 'type' => 'test_field', 'cardinality' => 4);
$this->field = field_create_field($this->field);
diff --git a/core/modules/file/tests/file.test b/core/modules/file/tests/file.test
index bad8f99..a99fa5a 100644
--- a/core/modules/file/tests/file.test
+++ b/core/modules/file/tests/file.test
@@ -9,6 +9,8 @@
* Provides methods specifically for testing File module's field handling.
*/
class FileFieldTestCase extends DrupalWebTestCase {
+ protected $profile = 'standard';
+
protected $admin_user;
function setUp() {
diff --git a/core/modules/filter/filter.test b/core/modules/filter/filter.test
index 2bafd47..3b9dc07 100644
--- a/core/modules/filter/filter.test
+++ b/core/modules/filter/filter.test
@@ -161,6 +161,8 @@ class FilterCRUDTestCase extends DrupalWebTestCase {
}
class FilterAdminTestCase extends DrupalWebTestCase {
+ protected $profile = 'standard';
+
public static function getInfo() {
return array(
'name' => 'Filter administration functionality',
@@ -419,6 +421,19 @@ class FilterFormatAccessTestCase extends DrupalWebTestCase {
function setUp() {
parent::setUp();
+ $type = array(
+ 'type' => 'page',
+ 'name' => t('Basic page'),
+ 'base' => 'node_content',
+ 'custom' => 1,
+ 'modified' => 1,
+ 'locked' => 0,
+ );
+ $type = node_type_set_defaults($type);
+ node_type_save($type);
+ node_add_body_field($type);
+ $this->resetAll();
+
// Create a user who can administer text formats, but does not have
// specific permission to use any of them.
$this->filter_admin_user = $this->drupalCreateUser(array(
diff --git a/core/modules/locale/locale.test b/core/modules/locale/locale.test
index 8ff85ed..7e7d718 100644
--- a/core/modules/locale/locale.test
+++ b/core/modules/locale/locale.test
@@ -1849,6 +1849,8 @@ class LocalePathFunctionalTest extends DrupalWebTestCase {
* Functional tests for multilingual support on nodes.
*/
class LocaleContentFunctionalTest extends DrupalWebTestCase {
+ protected $profile = 'standard';
+
public static function getInfo() {
return array(
'name' => 'Content language settings',
@@ -2538,6 +2540,7 @@ class LocaleMultilingualFieldsFunctionalTest extends DrupalWebTestCase {
* Functional tests for comment language.
*/
class LocaleCommentLanguageFunctionalTest extends DrupalWebTestCase {
+ protected $profile = 'standard';
public static function getInfo() {
return array(
diff --git a/core/modules/node/node.test b/core/modules/node/node.test
index a04b0e6..f43d748 100644
--- a/core/modules/node/node.test
+++ b/core/modules/node/node.test
@@ -668,7 +668,7 @@ class NodeBlockTestCase extends DrupalWebTestCase {
}
function setUp() {
- parent::setUp();
+ parent::setUp(array('block'));
// Create and login user
$admin_user = $this->drupalCreateUser(array('administer blocks'));
diff --git a/core/modules/poll/poll.test b/core/modules/poll/poll.test
index 20a4678..1763e1b 100644
--- a/core/modules/poll/poll.test
+++ b/core/modules/poll/poll.test
@@ -357,7 +357,7 @@ class PollBlockTestCase extends PollTestCase {
}
function setUp() {
- parent::setUp('poll');
+ parent::setUp(array('poll', 'block'));
// Create and login user
$admin_user = $this->drupalCreateUser(array('administer blocks'));
diff --git a/core/modules/search/search.test b/core/modules/search/search.test
index 6909efd..7548c4d 100644
--- a/core/modules/search/search.test
+++ b/core/modules/search/search.test
@@ -11,7 +11,47 @@ const SEARCH_TYPE = '_test_';
const SEARCH_TYPE_2 = '_test2_';
const SEARCH_TYPE_JPN = '_test3_';
-class SearchMatchTestCase extends DrupalWebTestCase {
+class SearchWebTestCase extends DrupalWebTestCase {
+ function setUp() {
+ $modules = func_get_args();
+ if (isset($modules[0]) && is_array($modules[0])) {
+ $modules = $modules[0];
+ }
+ $modules[] = 'node';
+ $modules[] = 'search';
+ parent::setUp($modules);
+
+ // Create Basic page and Article node types.
+ $types = array(
+ array(
+ 'type' => 'page',
+ 'name' => st('Basic page'),
+ 'base' => 'node_content',
+ 'description' => st("Use basic pages for your static content, such as an 'About us' page."),
+ 'custom' => 1,
+ 'modified' => 1,
+ 'locked' => 0,
+ ),
+ array(
+ 'type' => 'article',
+ 'name' => st('Article'),
+ 'base' => 'node_content',
+ 'description' => st('Use articles for time-sensitive content like news, press releases or blog posts.'),
+ 'custom' => 1,
+ 'modified' => 1,
+ 'locked' => 0,
+ ),
+ );
+ foreach ($types as $type) {
+ $type = node_type_set_defaults($type);
+ node_type_save($type);
+ node_add_body_field($type);
+ }
+ $this->resetAll();
+ }
+}
+
+class SearchMatchTestCase extends SearchWebTestCase {
public static function getInfo() {
return array(
'name' => 'Search engine queries',
@@ -21,13 +61,6 @@ class SearchMatchTestCase extends DrupalWebTestCase {
}
/**
- * Implementation setUp().
- */
- function setUp() {
- parent::setUp('search');
- }
-
- /**
* Test search indexing.
*/
function testMatching() {
@@ -243,7 +276,7 @@ class SearchMatchTestCase extends DrupalWebTestCase {
/**
* Tests the bike shed text on no results page, and text on the search page.
*/
-class SearchPageText extends DrupalWebTestCase {
+class SearchPageText extends SearchWebTestCase {
protected $searching_user;
public static function getInfo() {
@@ -255,7 +288,7 @@ class SearchPageText extends DrupalWebTestCase {
}
function setUp() {
- parent::setUp('search');
+ parent::setUp();
// Create user.
$this->searching_user = $this->drupalCreateUser(array('search content', 'access user profiles'));
@@ -307,7 +340,7 @@ class SearchPageText extends DrupalWebTestCase {
}
}
-class SearchAdvancedSearchForm extends DrupalWebTestCase {
+class SearchAdvancedSearchForm extends SearchWebTestCase {
protected $node;
public static function getInfo() {
@@ -319,7 +352,7 @@ class SearchAdvancedSearchForm extends DrupalWebTestCase {
}
function setUp() {
- parent::setUp('search');
+ parent::setUp();
// Create and login user.
$test_user = $this->drupalCreateUser(array('access content', 'search content', 'use advanced search', 'administer nodes'));
$this->drupalLogin($test_user);
@@ -370,7 +403,7 @@ class SearchAdvancedSearchForm extends DrupalWebTestCase {
}
}
-class SearchRankingTestCase extends DrupalWebTestCase {
+class SearchRankingTestCase extends SearchWebTestCase {
public static function getInfo() {
return array(
'name' => 'Search engine ranking',
@@ -379,11 +412,8 @@ class SearchRankingTestCase extends DrupalWebTestCase {
);
}
- /**
- * Implementation setUp().
- */
function setUp() {
- parent::setUp('search', 'statistics', 'comment');
+ parent::setUp(array('statistics', 'comment'));
}
function testRankings() {
@@ -580,7 +610,7 @@ class SearchRankingTestCase extends DrupalWebTestCase {
}
}
-class SearchBlockTestCase extends DrupalWebTestCase {
+class SearchBlockTestCase extends SearchWebTestCase {
public static function getInfo() {
return array(
'name' => 'Block availability',
@@ -590,7 +620,7 @@ class SearchBlockTestCase extends DrupalWebTestCase {
}
function setUp() {
- parent::setUp('search');
+ parent::setUp(array('block'));
// Create and login user
$admin_user = $this->drupalCreateUser(array('administer blocks', 'search content'));
@@ -660,7 +690,7 @@ class SearchBlockTestCase extends DrupalWebTestCase {
/**
* Tests that searching for a phrase gets the correct page count.
*/
-class SearchExactTestCase extends DrupalWebTestCase {
+class SearchExactTestCase extends SearchWebTestCase {
public static function getInfo() {
return array(
'name' => 'Search engine phrase queries',
@@ -669,10 +699,6 @@ class SearchExactTestCase extends DrupalWebTestCase {
);
}
- function setUp() {
- parent::setUp('search');
- }
-
/**
* Tests that the correct number of pager links are found for both keywords and phrases.
*/
@@ -721,7 +747,9 @@ class SearchExactTestCase extends DrupalWebTestCase {
/**
* Test integration searching comments.
*/
-class SearchCommentTestCase extends DrupalWebTestCase {
+class SearchCommentTestCase extends SearchWebTestCase {
+ protected $profile = 'standard';
+
protected $admin_user;
public static function getInfo() {
@@ -733,7 +761,7 @@ class SearchCommentTestCase extends DrupalWebTestCase {
}
function setUp() {
- parent::setUp('comment', 'search');
+ parent::setUp(array('comment'));
// Create and log in an administrative user having access to the Full HTML
// text format.
@@ -1017,7 +1045,7 @@ class SearchExpressionInsertExtractTestCase extends DrupalUnitTestCase {
* only when there are comments
* - Nodes with comment status set to Hidden should never show comment counts
*/
-class SearchCommentCountToggleTestCase extends DrupalWebTestCase {
+class SearchCommentCountToggleTestCase extends SearchWebTestCase {
protected $searching_user;
protected $searchable_nodes;
@@ -1030,7 +1058,7 @@ class SearchCommentCountToggleTestCase extends DrupalWebTestCase {
}
function setUp() {
- parent::setUp('search');
+ parent::setUp();
// Create searching user.
$this->searching_user = $this->drupalCreateUser(array('search content', 'access content', 'access comments', 'skip comment approval'));
@@ -1102,7 +1130,7 @@ class SearchCommentCountToggleTestCase extends DrupalWebTestCase {
/**
* Test search_simplify() on every Unicode character, and some other cases.
*/
-class SearchSimplifyTestCase extends DrupalWebTestCase {
+class SearchSimplifyTestCase extends SearchWebTestCase {
public static function getInfo() {
return array(
'name' => 'Search simplify',
@@ -1185,8 +1213,7 @@ class SearchSimplifyTestCase extends DrupalWebTestCase {
/**
* Tests keywords and conditions.
*/
-class SearchKeywordsConditions extends DrupalWebTestCase {
-
+class SearchKeywordsConditions extends SearchWebTestCase {
public static function getInfo() {
return array(
'name' => 'Keywords and conditions',
@@ -1196,7 +1223,7 @@ class SearchKeywordsConditions extends DrupalWebTestCase {
}
function setUp() {
- parent::setUp('search', 'search_extra_type');
+ parent::setUp(array('comment', 'search_extra_type'));
// Create searching user.
$this->searching_user = $this->drupalCreateUser(array('search content', 'access content', 'access comments', 'skip comment approval'));
// Login with sufficient privileges.
@@ -1236,7 +1263,7 @@ class SearchKeywordsConditions extends DrupalWebTestCase {
/**
* Tests that numbers can be searched.
*/
-class SearchNumbersTestCase extends DrupalWebTestCase {
+class SearchNumbersTestCase extends SearchWebTestCase {
protected $test_user;
protected $numbers;
protected $nodes;
@@ -1250,7 +1277,7 @@ class SearchNumbersTestCase extends DrupalWebTestCase {
}
function setUp() {
- parent::setUp('search');
+ parent::setUp();
$this->test_user = $this->drupalCreateUser(array('search content', 'access content', 'administer nodes', 'access site reports'));
$this->drupalLogin($this->test_user);
@@ -1324,7 +1351,7 @@ class SearchNumbersTestCase extends DrupalWebTestCase {
/**
* Tests that numbers can be searched, with more complex matching.
*/
-class SearchNumberMatchingTestCase extends DrupalWebTestCase {
+class SearchNumberMatchingTestCase extends SearchWebTestCase {
protected $test_user;
protected $numbers;
protected $nodes;
@@ -1338,7 +1365,7 @@ class SearchNumberMatchingTestCase extends DrupalWebTestCase {
}
function setUp() {
- parent::setUp('search');
+ parent::setUp();
$this->test_user = $this->drupalCreateUser(array('search content', 'access content', 'administer nodes', 'access site reports'));
$this->drupalLogin($this->test_user);
@@ -1407,7 +1434,7 @@ class SearchNumberMatchingTestCase extends DrupalWebTestCase {
/**
* Test config page.
*/
-class SearchConfigSettingsForm extends DrupalWebTestCase {
+class SearchConfigSettingsForm extends SearchWebTestCase {
public $search_user;
public $search_node;
@@ -1420,7 +1447,7 @@ class SearchConfigSettingsForm extends DrupalWebTestCase {
}
function setUp() {
- parent::setUp('search', 'search_extra_type');
+ parent::setUp(array('block', 'search_extra_type'));
// Login as a user that can create and search content.
$this->search_user = $this->drupalCreateUser(array('search content', 'administer search', 'administer nodes', 'bypass node access', 'access user profiles', 'administer users', 'administer blocks'));
@@ -1639,7 +1666,7 @@ class SearchExcerptTestCase extends DrupalUnitTestCase {
/**
* Test the CJK tokenizer.
*/
-class SearchTokenizerTestCase extends DrupalWebTestCase {
+class SearchTokenizerTestCase extends SearchWebTestCase {
public static function getInfo() {
return array(
'name' => 'CJK tokenizer',
@@ -1648,10 +1675,6 @@ class SearchTokenizerTestCase extends DrupalWebTestCase {
);
}
- function setUp() {
- parent::setUp('search');
- }
-
/**
* Verifies that strings of CJK characters are tokenized.
*
@@ -1790,7 +1813,7 @@ class SearchTokenizerTestCase extends DrupalWebTestCase {
/**
* Tests that we can embed a form in search results and submit it.
*/
-class SearchEmbedForm extends DrupalWebTestCase {
+class SearchEmbedForm extends SearchWebTestCase {
/**
* Node used for testing.
*/
@@ -1810,7 +1833,7 @@ class SearchEmbedForm extends DrupalWebTestCase {
}
function setUp() {
- parent::setUp('search', 'search_embedded_form');
+ parent::setUp(array('search_embedded_form'));
// Create a user and a node, and update the search index.
$test_user = $this->drupalCreateUser(array('access content', 'search content', 'administer nodes'));
@@ -1866,7 +1889,7 @@ class SearchEmbedForm extends DrupalWebTestCase {
/**
* Tests that hook_search_page runs.
*/
-class SearchPageOverride extends DrupalWebTestCase {
+class SearchPageOverride extends SearchWebTestCase {
public $search_user;
public static function getInfo() {
@@ -1878,7 +1901,7 @@ class SearchPageOverride extends DrupalWebTestCase {
}
function setUp() {
- parent::setUp('search', 'search_extra_type');
+ parent::setUp(array('search_extra_type'));
// Login as a user that can create and search content.
$this->search_user = $this->drupalCreateUser(array('search content', 'administer search'));
@@ -1900,7 +1923,7 @@ class SearchPageOverride extends DrupalWebTestCase {
/**
* Test node search with multiple languages.
*/
-class SearchLanguageTestCase extends DrupalWebTestCase {
+class SearchLanguageTestCase extends SearchWebTestCase {
public static function getInfo() {
return array(
'name' => 'Search language selection',
@@ -1909,11 +1932,8 @@ class SearchLanguageTestCase extends DrupalWebTestCase {
);
}
- /**
- * Implementation setUp().
- */
function setUp() {
- parent::setUp('search', 'locale');
+ parent::setUp(array('locale'));
// Create and login user.
$test_user = $this->drupalCreateUser(array('access content', 'search content', 'use advanced search', 'administer nodes', 'administer languages', 'access administration pages'));
@@ -1965,7 +1985,7 @@ class SearchLanguageTestCase extends DrupalWebTestCase {
/**
* Tests node search with node access control.
*/
-class SearchNodeAccessTest extends DrupalWebTestCase {
+class SearchNodeAccessTest extends SearchWebTestCase {
public $test_user;
public static function getInfo() {
@@ -1977,7 +1997,7 @@ class SearchNodeAccessTest extends DrupalWebTestCase {
}
function setUp() {
- parent::setUp('search', 'node_access_test');
+ parent::setUp(array('node_access_test'));
node_access_rebuild();
// Create a test user and log in.
diff --git a/core/modules/simpletest/drupal_web_test_case.php b/core/modules/simpletest/drupal_web_test_case.php
index 0edd3fd..f034387 100644
--- a/core/modules/simpletest/drupal_web_test_case.php
+++ b/core/modules/simpletest/drupal_web_test_case.php
@@ -765,7 +765,7 @@ class DrupalWebTestCase extends DrupalTestCase {
*
* @var string
*/
- protected $profile = 'standard';
+ protected $profile = 'testing';
/**
* The URL currently loaded in the internal browser.
@@ -1355,6 +1355,13 @@ class DrupalWebTestCase extends DrupalTestCase {
$test_info['test_run_id'] = $this->databasePrefix;
$test_info['in_child_site'] = FALSE;
+ // Preset the 'install_profile' system variable, so the first call into
+ // system_rebuild_module_data() (in drupal_install_system()) will register
+ // the test's profile as a module. Without this, the installation profile of
+ // the parent site (executing the test) is registered, and the test
+ // profile's hook_install() and other hook implementations are never invoked.
+ $conf['install_profile'] = $this->profile;
+
include_once DRUPAL_ROOT . '/core/includes/install.inc';
drupal_install_system();
diff --git a/core/modules/simpletest/tests/ajax.test b/core/modules/simpletest/tests/ajax.test
index 9a76b96..d502b23 100644
--- a/core/modules/simpletest/tests/ajax.test
+++ b/core/modules/simpletest/tests/ajax.test
@@ -58,8 +58,6 @@ class AJAXTestCase extends DrupalWebTestCase {
* Tests primary Ajax framework functions.
*/
class AJAXFrameworkTestCase extends AJAXTestCase {
- protected $profile = 'testing';
-
public static function getInfo() {
return array(
'name' => 'AJAX framework',
@@ -384,6 +382,8 @@ class AJAXFormValuesTestCase extends AJAXTestCase {
* Tests that Ajax-enabled forms work when multiple instances of the same form are on a page.
*/
class AJAXMultiFormTestCase extends AJAXTestCase {
+ protected $profile = 'standard';
+
public static function getInfo() {
return array(
'name' => 'AJAX multi form',
diff --git a/core/modules/simpletest/tests/common.test b/core/modules/simpletest/tests/common.test
index 8936808..8acbd9e 100644
--- a/core/modules/simpletest/tests/common.test
+++ b/core/modules/simpletest/tests/common.test
@@ -18,7 +18,7 @@ class DrupalAlterTestCase extends DrupalWebTestCase {
}
function setUp() {
- parent::setUp('common_test');
+ parent::setUp(array('block', 'common_test'));
}
function testDrupalAlter() {
@@ -2196,11 +2196,6 @@ class ParseInfoFilesTestCase extends DrupalWebTestCase {
* Tests for the drupal_system_listing() function.
*/
class DrupalSystemListingTestCase extends DrupalWebTestCase {
- /**
- * Use the testing profile; this is needed for testDirectoryPrecedence().
- */
- protected $profile = 'testing';
-
public static function getInfo() {
return array(
'name' => 'Drupal system listing',
diff --git a/core/modules/simpletest/tests/database_test.test b/core/modules/simpletest/tests/database_test.test
index 6e55fbd..164ddce 100644
--- a/core/modules/simpletest/tests/database_test.test
+++ b/core/modules/simpletest/tests/database_test.test
@@ -16,8 +16,6 @@ class FakeRecord { }
* here.
*/
class DatabaseTestCase extends DrupalWebTestCase {
- protected $profile = 'testing';
-
function setUp() {
parent::setUp('database_test');
diff --git a/core/modules/simpletest/tests/form.test b/core/modules/simpletest/tests/form.test
index 94dfa87..504a111 100644
--- a/core/modules/simpletest/tests/form.test
+++ b/core/modules/simpletest/tests/form.test
@@ -372,8 +372,6 @@ class FormsTestCase extends DrupalWebTestCase {
* Tests building and processing of core form elements.
*/
class FormElementTestCase extends DrupalWebTestCase {
- protected $profile = 'testing';
-
public static function getInfo() {
return array(
'name' => 'Element processing',
diff --git a/core/modules/simpletest/tests/menu.test b/core/modules/simpletest/tests/menu.test
index d0612ac..9bc9d28 100644
--- a/core/modules/simpletest/tests/menu.test
+++ b/core/modules/simpletest/tests/menu.test
@@ -647,9 +647,6 @@ class MenuRouterTestCase extends DrupalWebTestCase {
* Tests for menu links.
*/
class MenuLinksUnitTestCase extends DrupalWebTestCase {
- // Use the lightweight testing profile for this test.
- protected $profile = 'testing';
-
public static function getInfo() {
return array(
'name' => 'Menu links',
@@ -1017,6 +1014,8 @@ class MenuTreeOutputTestCase extends DrupalWebTestCase {
* Menu breadcrumbs related tests.
*/
class MenuBreadcrumbTestCase extends MenuWebTestCase {
+ protected $profile = 'standard';
+
public static function getInfo() {
return array(
'name' => 'Breadcrumbs',
@@ -1026,12 +1025,8 @@ class MenuBreadcrumbTestCase extends MenuWebTestCase {
}
function setUp() {
- $modules = func_get_args();
- if (isset($modules[0]) && is_array($modules[0])) {
- $modules = $modules[0];
- }
- $modules[] = 'menu_test';
- parent::setUp($modules);
+ parent::setUp(array('menu_test'));
+
$perms = array_keys(module_invoke_all('permission'));
$this->admin_user = $this->drupalCreateUser($perms);
$this->drupalLogin($this->admin_user);
@@ -1520,12 +1515,7 @@ class MenuTrailTestCase extends MenuWebTestCase {
}
function setUp() {
- $modules = func_get_args();
- if (isset($modules[0]) && is_array($modules[0])) {
- $modules = $modules[0];
- }
- $modules[] = 'menu_test';
- parent::setUp($modules);
+ parent::setUp(array('block', 'menu_test'));
$this->admin_user = $this->drupalCreateUser(array('administer site configuration', 'access administration pages'));
$this->drupalLogin($this->admin_user);
diff --git a/core/modules/simpletest/tests/password.test b/core/modules/simpletest/tests/password.test
index e0139e9..2797786 100644
--- a/core/modules/simpletest/tests/password.test
+++ b/core/modules/simpletest/tests/password.test
@@ -9,8 +9,6 @@
* Unit tests for password hashing API.
*/
class PasswordHashingTest extends DrupalWebTestCase {
- protected $profile = 'testing';
-
public static function getInfo() {
return array(
'name' => 'Password hashing',
diff --git a/core/modules/simpletest/tests/theme.test b/core/modules/simpletest/tests/theme.test
index 6fb6b3b..7649e3d 100644
--- a/core/modules/simpletest/tests/theme.test
+++ b/core/modules/simpletest/tests/theme.test
@@ -9,8 +9,6 @@
* Unit tests for the Theme API.
*/
class ThemeUnitTest extends DrupalWebTestCase {
- protected $profile = 'testing';
-
public static function getInfo() {
return array(
'name' => 'Theme API',
@@ -178,8 +176,6 @@ class ThemeTableUnitTest extends DrupalWebTestCase {
* Tests for common theme functions.
*/
class ThemeFunctionsTestCase extends DrupalWebTestCase {
- protected $profile = 'testing';
-
public static function getInfo() {
return array(
'name' => 'Theme functions',
diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc
index 6dca80b..117bf5e 100644
--- a/core/modules/system/system.admin.inc
+++ b/core/modules/system/system.admin.inc
@@ -1487,7 +1487,7 @@ function system_site_information_settings() {
$form['front_page']['site_frontpage'] = array(
'#type' => 'textfield',
'#title' => t('Default front page'),
- '#default_value' => (variable_get('site_frontpage')!='node'?drupal_get_path_alias(variable_get('site_frontpage', 'node')):''),
+ '#default_value' => (variable_get('site_frontpage')!='user'?drupal_get_path_alias(variable_get('site_frontpage', 'user')):''),
'#size' => 40,
'#description' => t('Optionally, specify a relative URL to display as the front page. Leave blank to display the default content feed.'),
'#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q='),
@@ -1536,7 +1536,7 @@ function system_site_information_settings_validate($form, &$form_state) {
// Check for empty front page path.
if (empty($form_state['values']['site_frontpage'])) {
// Set to default "node".
- form_set_value($form['front_page']['site_frontpage'], 'node', $form_state);
+ form_set_value($form['front_page']['site_frontpage'], 'user', $form_state);
}
else {
// Get the normal path of the front page.
diff --git a/core/modules/system/system.module b/core/modules/system/system.module
index 625be0a..12da274 100644
--- a/core/modules/system/system.module
+++ b/core/modules/system/system.module
@@ -2036,8 +2036,12 @@ function system_user_timezone(&$form, &$form_state) {
function system_block_info() {
$blocks['main'] = array(
'info' => t('Main page content'),
- // Cached elsewhere.
+ // Cached elsewhere.
'cache' => DRUPAL_NO_CACHE,
+ // Automatically try to assign the main content to the "content" region, in
+ // case such a region exists.
+ 'region' => 'content',
+ 'status' => 1,
);
$blocks['powered-by'] = array(
'info' => t('Powered by Drupal'),
@@ -2358,10 +2362,10 @@ function _system_rebuild_module_data() {
// Include the install profile in modules that are loaded.
$profile = drupal_get_profile();
+ debug($profile);
$modules[$profile] = new stdClass();
$modules[$profile]->name = $profile;
$modules[$profile]->uri = 'profiles/' . $profile . '/' . $profile . '.profile';
- $modules[$profile]->filename = $profile . '.profile';
// Install profile hooks are always executed last.
$modules[$profile]->weight = 1000;
diff --git a/core/modules/system/system.test b/core/modules/system/system.test
index 4e3761d..c767254 100644
--- a/core/modules/system/system.test
+++ b/core/modules/system/system.test
@@ -130,8 +130,6 @@ class ModuleTestCase extends DrupalWebTestCase {
* Test module enabling/disabling functionality.
*/
class EnableDisableTestCase extends ModuleTestCase {
- protected $profile = 'testing';
-
public static function getInfo() {
return array(
'name' => 'Enable/disable modules',
@@ -885,10 +883,13 @@ class AccessDeniedTestCase extends DrupalWebTestCase {
}
function setUp() {
- parent::setUp();
+ parent::setUp(array('block'));
// Create an administrative user.
$this->admin_user = $this->drupalCreateUser(array('access administration pages', 'administer site configuration', 'administer blocks'));
+
+ user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access user profiles'));
+ user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array('access user profiles'));
}
function testAccessDenied() {
@@ -896,34 +897,34 @@ class AccessDeniedTestCase extends DrupalWebTestCase {
$this->assertText(t('Access denied'), t('Found the default 403 page'));
$this->assertResponse(403);
+ // Use a custom 403 page.
$this->drupalLogin($this->admin_user);
$edit = array(
- 'title' => $this->randomName(10),
- 'body' => array(LANGUAGE_NONE => array(array('value' => $this->randomName(100)))),
+ 'site_403' => 'user/' . $this->admin_user->uid,
);
- $node = $this->drupalCreateNode($edit);
-
- // Use a custom 403 page.
- $this->drupalPost('admin/config/system/site-information', array('site_403' => 'node/' . $node->nid), t('Save configuration'));
+ $this->drupalPost('admin/config/system/site-information', $edit, t('Save configuration'));
- $this->drupalLogout();
- $this->drupalGet('admin');
- $this->assertText($node->title, t('Found the custom 403 page'));
+ // Enable the user login block.
+ $edit = array(
+ 'blocks[user_login][region]' => 'sidebar_first',
+ );
+ $this->drupalPost('admin/structure/block', $edit, t('Save blocks'));
// Logout and check that the user login block is shown on custom 403 pages.
$this->drupalLogout();
-
$this->drupalGet('admin');
- $this->assertText($node->title, t('Found the custom 403 page'));
+ $this->assertText($this->admin_user->name, t('Found the custom 403 page'));
$this->assertText(t('User login'), t('Blocks are shown on the custom 403 page'));
// Log back in and remove the custom 403 page.
$this->drupalLogin($this->admin_user);
- $this->drupalPost('admin/config/system/site-information', array('site_403' => ''), t('Save configuration'));
+ $edit = array(
+ 'site_403' => '',
+ );
+ $this->drupalPost('admin/config/system/site-information', $edit, t('Save configuration'));
// Logout and check that the user login block is shown on default 403 pages.
$this->drupalLogout();
-
$this->drupalGet('admin');
$this->assertText(t('Access denied'), t('Found the default 403 page'));
$this->assertResponse(403);
@@ -950,9 +951,6 @@ class AccessDeniedTestCase extends DrupalWebTestCase {
class PageNotFoundTestCase extends DrupalWebTestCase {
protected $admin_user;
- /**
- * Implement getInfo().
- */
public static function getInfo() {
return array(
'name' => '404 functionality',
@@ -961,32 +959,29 @@ class PageNotFoundTestCase extends DrupalWebTestCase {
);
}
- /**
- * Implement setUp().
- */
function setUp() {
parent::setUp();
// Create an administrative user.
$this->admin_user = $this->drupalCreateUser(array('administer site configuration'));
- $this->drupalLogin($this->admin_user);
+
+ user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access user profiles'));
+ user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array('access user profiles'));
}
function testPageNotFound() {
+ $this->drupalLogin($this->admin_user);
$this->drupalGet($this->randomName(10));
$this->assertText(t('Page not found'), t('Found the default 404 page'));
+ // Use a custom 404 page.
$edit = array(
- 'title' => $this->randomName(10),
- 'body' => array(LANGUAGE_NONE => array(array('value' => $this->randomName(100)))),
+ 'site_404' => 'user/' . $this->admin_user->uid,
);
- $node = $this->drupalCreateNode($edit);
-
- // Use a custom 404 page.
- $this->drupalPost('admin/config/system/site-information', array('site_404' => 'node/' . $node->nid), t('Save configuration'));
+ $this->drupalPost('admin/config/system/site-information', $edit, t('Save configuration'));
$this->drupalGet($this->randomName(10));
- $this->assertText($node->title, t('Found the custom 404 page'));
+ $this->assertText($this->admin_user->name, t('Found the custom 404 page'));
}
}
@@ -1447,8 +1442,6 @@ class FrontPageTestCase extends DrupalWebTestCase {
}
class SystemBlockTestCase extends DrupalWebTestCase {
- protected $profile = 'testing';
-
public static function getInfo() {
return array(
'name' => 'Block functionality',
diff --git a/core/modules/user/user.test b/core/modules/user/user.test
index 39d90d1..9267a9a 100644
--- a/core/modules/user/user.test
+++ b/core/modules/user/user.test
@@ -455,6 +455,8 @@ class UserLoginTestCase extends DrupalWebTestCase {
* Test cancelling a user.
*/
class UserCancelTestCase extends DrupalWebTestCase {
+ protected $profile = 'standard';
+
public static function getInfo() {
return array(
'name' => 'Cancel account',