Commit cdab74ee authored by alexpott's avatar alexpott

Issue #1541298 by sun, Berdir: Remove Node module dependency from Testing profile.

parent 9d5d0eab
......@@ -21,7 +21,7 @@ class BulkFormTest extends WebTestBase {
*
* @var array
*/
public static $modules = array('action_bulk_test');
public static $modules = array('node', 'action_bulk_test');
public static function getInfo() {
return array(
......
......@@ -12,16 +12,6 @@
*/
class CustomBlockPageViewTest extends CustomBlockTestBase {
/**
* Permissions to grant admin user.
*
* @var array
*/
protected $permissions = array(
'administer blocks',
'access content'
);
/**
* Modules to enable.
*
......
......@@ -40,7 +40,7 @@ function setUp() {
$this->drupalPlaceBlock('test_html', array('id' => 'test_html_block'));
// Enable a menu block, to test more complicated HTML.
$this->drupalPlaceBlock('system_menu_block:tools');
$this->drupalPlaceBlock('system_menu_block:admin');
}
/**
......
......@@ -19,7 +19,7 @@ class BlockRenderOrderTest extends WebTestBase {
*
* @var array
*/
public static $modules = array('block');
public static $modules = array('node', 'block');
public static function getInfo() {
return array(
......
......@@ -24,7 +24,7 @@ class DisplayBlockTest extends ViewTestBase {
*
* @var array
*/
public static $modules = array('block_test_views', 'test_page_test', 'contextual', 'views_ui');
public static $modules = array('node', 'block_test_views', 'test_page_test', 'contextual', 'views_ui');
/**
* Views used by this test.
......
......@@ -369,10 +369,9 @@ public static function baseFieldDefinitions($entity_type) {
->setDescription(t('The parent comment ID if this is a reply to a comment.'))
->setSetting('target_type', 'comment');
$fields['entity_id'] = FieldDefinition::create('entity_reference')
$fields['entity_id'] = FieldDefinition::create('integer')
->setLabel(t('Entity ID'))
->setDescription(t('The ID of the entity of which this comment is a reply.'))
->setSetting('target_type', 'node')
->setRequired(TRUE);
$fields['langcode'] = FieldDefinition::create('language')
......
......@@ -23,7 +23,7 @@ class CommentLanguageTest extends WebTestBase {
*
* @var array
*/
public static $modules = array('language', 'language_test', 'comment_test');
public static $modules = array('node', 'language', 'language_test', 'comment_test');
public static function getInfo() {
return array(
......
......@@ -20,7 +20,7 @@ abstract class CommentTestBase extends ViewTestBase {
*
* @var array
*/
public static $modules = array('comment', 'comment_test_views');
public static $modules = array('node', 'comment', 'comment_test_views');
/**
* Stores a comment used by the tests.
......
......@@ -18,7 +18,7 @@ class DefaultViewRecentComments extends ViewTestBase {
*
* @var array
*/
public static $modules = array('comment', 'block');
public static $modules = array('node', 'comment', 'block');
/**
* Number of results for the Master display.
......
......@@ -21,7 +21,7 @@ class WizardTest extends WizardTestBase {
*
* @var array
*/
public static $modules = array('comment');
public static $modules = array('node', 'comment');
public static function getInfo() {
......
......@@ -23,7 +23,7 @@ class ConfigTranslationUiTest extends WebTestBase {
*
* @var array
*/
public static $modules = array('contact', 'config_translation', 'config_translation_test', 'views', 'views_ui', 'contextual');
public static $modules = array('node', 'contact', 'config_translation', 'config_translation_test', 'views', 'views_ui', 'contextual');
/**
* Languages to enable.
......
......@@ -19,7 +19,7 @@ class ConfigTranslationViewListUiTest extends UITestBase {
*
* @var array
*/
public static $testViews = array('test_view');
public static $testViews = array('node', 'test_view');
/**
* Modules to enable.
......
......@@ -11,10 +11,7 @@ display:
position: 1
display_options:
access:
type: perm
options:
perm: 'access content'
perm: 'access user profiles'
type: none
cache:
type: none
options: { }
......
......@@ -21,7 +21,7 @@ public static function getInfo() {
);
}
public static $modules = array('field_ui', 'entity_reference');
public static $modules = array('node', 'field_ui', 'entity_reference');
public function setUp() {
parent::setUp();
......
......@@ -14,7 +14,7 @@
*/
class SelectionTest extends WebTestBase {
public static $modules = array('views', 'entity_reference', 'entity_reference_test', 'entity_test');
public static $modules = array('node', 'views', 'entity_reference', 'entity_reference_test', 'entity_test');
public static function getInfo() {
return array(
......
......@@ -32,7 +32,7 @@ abstract class FieldTestBase extends ViewTestBase {
*
* @var array
*/
public static $modules = array('field_test_views');
public static $modules = array('node', 'field_test_views');
/**
* Stores the field definitions used by the test.
......
......@@ -20,7 +20,7 @@ abstract class FileFieldTestBase extends WebTestBase {
*
* @var array
*/
public static $modules = array('file', 'file_module_test', 'field_ui');
public static $modules = array('node', 'file', 'file_module_test', 'field_ui');
protected $admin_user;
......
......@@ -36,7 +36,7 @@ public static function getInfo() {
function setUp() {
parent::setUp();
$account = $this->drupalCreateUser(array('access content'));
$account = $this->drupalCreateUser();
$this->drupalLogin($account);
$image_files = $this->drupalGetTestFiles('image');
......
......@@ -13,6 +13,14 @@
* Tests the filter format access functionality in the Filter module.
*/
class FilterFormatAccessTest extends WebTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array('filter', 'node');
/**
* A user with administrative permissions.
*
......
......@@ -22,7 +22,7 @@ class FileDenormalizeTest extends WebTestBase {
*
* @var array
*/
public static $modules = array('hal', 'file');
public static $modules = array('hal', 'file', 'node');
public static function getInfo() {
return array(
......
......@@ -20,7 +20,7 @@ class LanguageConfigurationElementTest extends WebTestBase {
*
* @var array
*/
public static $modules = array('language', 'language_elements_test');
public static $modules = array('node', 'language', 'language_elements_test');
public static function getInfo() {
return array(
......
......@@ -19,7 +19,7 @@ class LocaleContentTest extends WebTestBase {
*
* @var array
*/
public static $modules = array('locale');
public static $modules = array('node', 'locale');
public static function getInfo() {
return array(
......
......@@ -17,7 +17,7 @@ class MenuTest extends MenuWebTestBase {
*
* @var array
*/
public static $modules = array('block', 'contextual', 'help', 'path', 'test_page_test');
public static $modules = array('node', 'block', 'contextual', 'help', 'path', 'test_page_test');
/**
* A user with administration rights.
......
......@@ -13,6 +13,13 @@
class MigrateNodeConfigsTest extends MigrateDrupalTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array('node');
/**
* {@inheritdoc}
*/
......
......@@ -423,6 +423,18 @@ function node_schema() {
* Implements hook_install().
*/
function node_install() {
// Enable default permissions for system roles.
// IMPORTANT: Modules SHOULD NOT automatically grant any user role access
// permissions in hook_install().
// However, the 'access content' permission is a very special case, since
// there is hardly a point in installing the Node module without granting
// these permissions. Doing so also allows tests to continue to operate as
// expected without first having to manually grant these default permissions.
if (\Drupal::moduleHandler()->moduleExists('user')) {
user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access content'));
user_role_grant_permissions(DRUPAL_AUTHENTICATED_RID, array('access content'));
}
// Populate the node access table.
db_insert('node_access')
->fields(array(
......
......@@ -19,7 +19,7 @@ class OptionsFieldUITest extends FieldTestBase {
*
* @var array
*/
public static $modules = array('options', 'field_test', 'taxonomy', 'field_ui');
public static $modules = array('node', 'options', 'field_test', 'taxonomy', 'field_ui');
/**
* The name of the created content type.
......
......@@ -19,7 +19,7 @@ class OptionsWidgetsTest extends FieldTestBase {
*
* @var array
*/
public static $modules = array('options', 'entity_test', 'options_test', 'taxonomy', 'field_ui');
public static $modules = array('node', 'options', 'entity_test', 'options_test', 'taxonomy', 'field_ui');
/**
* A field with cardinality 1 to use in this test class.
......
......@@ -19,7 +19,7 @@ class UserAttributesTest extends WebTestBase {
*
* @var array
*/
public static $modules = array('rdf');
public static $modules = array('rdf', 'node');
public static function getInfo() {
return array(
......
......@@ -43,6 +43,13 @@ abstract class RESTTestBase extends WebTestBase {
*/
protected $defaultAuth;
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array('rest', 'entity_test', 'node');
protected function setUp() {
parent::setUp();
$this->defaultFormat = 'hal_json';
......
......@@ -20,7 +20,7 @@ abstract class ShortcutTestBase extends WebTestBase {
*
* @var array
*/
public static $modules = array('toolbar', 'shortcut');
public static $modules = array('node', 'toolbar', 'shortcut');
/**
* User with permission to administer shortcuts.
......
......@@ -146,7 +146,7 @@ function testUserAgentValidation() {
function testWebTestRunner() {
$this->pass = t('SimpleTest pass.');
$this->fail = t('SimpleTest fail.');
$this->valid_permission = 'access content';
$this->valid_permission = 'access administration pages';
$this->invalid_permission = 'invalid permission';
if ($this->isInChildSite()) {
......
......@@ -22,7 +22,7 @@ class StatisticsLoggingTest extends WebTestBase {
*
* @var array
*/
public static $modules = array('statistics', 'block');
public static $modules = array('node', 'statistics', 'block');
/**
* The Guzzle HTTP client.
......
......@@ -23,7 +23,7 @@ class IntegrationTest extends ViewTestBase {
*
* @var array
*/
public static $modules = array('statistics', 'statistics_test_views');
public static $modules = array('statistics', 'statistics_test_views', 'node');
/**
* Stores the user object that accesses the page.
......
......@@ -19,7 +19,7 @@ abstract class AjaxTestBase extends WebTestBase {
*
* @var array
*/
public static $modules = array('ajax_test', 'ajax_forms_test');
public static $modules = array('node', 'ajax_test', 'ajax_forms_test');
/**
* Asserts the array of Ajax commands contains the searched command.
......
......@@ -19,7 +19,7 @@ class WriteRecordTest extends WebTestBase {
*
* @var array
*/
public static $modules = array('database_test');
public static $modules = array('database_test', 'node');
public static function getInfo() {
return array(
......
......@@ -34,9 +34,6 @@ public function setUp() {
// Create and login user.
$this->web_user = $this->drupalCreateUser(array(
'view all revisions',
'revert all revisions',
'delete all revisions',
'administer entity_test content',
));
$this->drupalLogin($this->web_user);
......
......@@ -22,7 +22,7 @@ class RebuildTest extends WebTestBase {
*
* @var array
*/
public static $modules = array('form_test');
public static $modules = array('node', 'form_test');
public static function getInfo() {
return array(
......
......@@ -38,7 +38,7 @@ public static function getInfo() {
function setUp() {
parent::setUp();
$this->web_user = $this->drupalCreateUser(array('access content'));
$this->web_user = $this->drupalCreateUser();
$this->drupalLogin($this->web_user);
}
......
......@@ -127,7 +127,7 @@ protected function doTestDescriptionMenuItems() {
* Tests for menu_link_maintain().
*/
protected function doTestMenuLinkMaintain() {
$admin_user = $this->drupalCreateUser(array('access content', 'administer site configuration'));
$admin_user = $this->drupalCreateUser(array('administer site configuration'));
$this->drupalLogin($admin_user);
// Create three menu items.
......
......@@ -121,12 +121,13 @@ function testModuleEnableOrder() {
$this->assertModules(array('module_test'), TRUE);
\Drupal::state()->set('module_test.dependency', 'dependency');
// module_test creates a dependency chain:
// - forum depends on taxonomy, comment, datetime, history, and ban (via module_test)
// - forum depends on node, taxonomy, comment, datetime, history, and
// ban (via module_test)
// - taxonomy depends on options
// - options depends on number
// - ban depends on xmlrpc (via module_test)
// The correct enable order is:
$expected_order = array('xmlrpc', 'ban', 'datetime', 'comment', 'history', 'number', 'options', 'taxonomy', 'forum');
$expected_order = array('xmlrpc', 'ban', 'node', 'datetime', 'comment', 'history', 'number', 'options', 'taxonomy', 'forum');
// Enable the modules through the UI, verifying that the dependency chain
// is correct.
......@@ -134,7 +135,8 @@ function testModuleEnableOrder() {
$edit['modules[Core][forum][enable]'] = 'forum';
$this->drupalPostForm('admin/modules', $edit, t('Save configuration'));
$this->assertModules(array('forum'), FALSE);
$this->assertText(t('You must enable the History, Taxonomy, Options, Number, Comment, Datetime, Ban, XML-RPC modules to install Forum.'));
$this->assertText(t('You must enable the Node, History, Taxonomy, Options, Number, Comment, Datetime, Ban, XML-RPC modules to install Forum.'));
$edit['modules[Core][node][enable]'] = 'node';
$edit['modules[Core][history][enable]'] = 'history';
$edit['modules[Field types][options][enable]'] = 'options';
$edit['modules[Field types][number][enable]'] = 'number';
......@@ -144,7 +146,7 @@ function testModuleEnableOrder() {
$edit['modules[Core][ban][enable]'] = 'ban';
$edit['modules[Core][xmlrpc][enable]'] = 'xmlrpc';
$this->drupalPostForm('admin/modules', $edit, t('Save configuration'));
$this->assertModules(array('forum', 'ban', 'xmlrpc', 'datetime', 'comment', 'history', 'taxonomy', 'options', 'number'), TRUE);
$this->assertModules(array('forum', 'ban', 'node', 'xmlrpc', 'datetime', 'comment', 'history', 'taxonomy', 'options', 'number'), TRUE);
// Check the actual order which is saved by module_test_modules_enabled().
$module_order = \Drupal::state()->get('module_test.install_order') ?: array();
......
......@@ -28,7 +28,7 @@ public static function getInfo() {
);
}
public static $modules = array('paramconverter_test');
public static $modules = array('paramconverter_test', 'node');
/**
* Confirms that all parameters are converted as expected.
......
......@@ -39,7 +39,7 @@ function testSessionSaveRegenerate() {
$this->assertTrue(drupal_save_session(), 'drupal_save_session() correctly returns TRUE when saving has been enabled.', 'Session');
// Test session hardening code from SA-2008-044.
$user = $this->drupalCreateUser(array('access content'));
$user = $this->drupalCreateUser();
// Enable sessions.
$this->sessionReset($user->id());
......@@ -81,7 +81,7 @@ function testSessionSaveRegenerate() {
* Test data persistence via the session_test module callbacks.
*/
function testDataPersistence() {
$user = $this->drupalCreateUser(array('access content'));
$user = $this->drupalCreateUser(array());
// Enable sessions.
$this->sessionReset($user->id());
......@@ -133,7 +133,7 @@ function testDataPersistence() {
$this->assertNoText($value_1, 'Session has persisted for an authenticated user after logging out and then back in.', 'Session');
// Change session and create another user.
$user2 = $this->drupalCreateUser(array('access content'));
$user2 = $this->drupalCreateUser(array());
$this->sessionReset($user2->id());
$this->drupalLogin($user2);
}
......@@ -198,7 +198,7 @@ function testEmptyAnonymousSession() {
* Test that sessions are only saved when necessary.
*/
function testSessionWrite() {
$user = $this->drupalCreateUser(array('access content'));
$user = $this->drupalCreateUser(array());
$this->drupalLogin($user);
$sql = 'SELECT u.access, s.timestamp FROM {users} u INNER JOIN {sessions} s ON u.uid = s.uid WHERE u.uid = :uid';
......@@ -246,7 +246,7 @@ function testSessionWrite() {
* Test that empty session IDs are not allowed.
*/
function testEmptySessionID() {
$user = $this->drupalCreateUser(array('access content'));
$user = $this->drupalCreateUser(array());
$this->drupalLogin($user);
$this->drupalGet('session-test/is-logged-in');
$this->assertResponse(200, 'User is logged in.');
......
......@@ -20,7 +20,7 @@ class DateTimeTest extends WebTestBase {
*
* @var array
*/
public static $modules = array('language');
public static $modules = array('node', 'language');
public static function getInfo() {
return array(
......
......@@ -20,7 +20,7 @@ class ThemeTest extends WebTestBase {
*
* @var array
*/
public static $modules = array('theme_test');
public static $modules = array('theme_test', 'node');
public static function getInfo() {
return array(
......
......@@ -19,7 +19,7 @@ class TwigDebugMarkupTest extends WebTestBase {
*
* @var array
*/
public static $modules = array('theme_test');
public static $modules = array('theme_test', 'node');
public static function getInfo() {
return array(
......
......@@ -5,6 +5,7 @@ package: Core
version: VERSION
core: 8.x
dependencies:
- node
- options
- text
configure: taxonomy.vocabulary_list
......@@ -53,7 +53,7 @@ class ToolbarAdminMenuTest extends WebTestBase {
*
* @var array
*/
public static $modules = array('block', 'menu', 'user', 'taxonomy', 'toolbar', 'language', 'test_page_test', 'locale');
public static $modules = array('node', 'block', 'menu', 'user', 'taxonomy', 'toolbar', 'language', 'test_page_test', 'locale');
public static function getInfo() {
return array(
......
......@@ -2,6 +2,7 @@ name: Tracker
type: module
description: 'Enables tracking of recent content for users.'
dependencies:
- node
- comment
package: Core
version: VERSION
......
......@@ -207,7 +207,7 @@ function tracker_comment_update(CommentInterface $comment) {
// $comment->save() calls hook_comment_publish() for all published comments
// so we need to handle all other values here.
if ($comment->status->value != CommentInterface::PUBLISHED && $comment->entity_type->value == 'node') {
_tracker_remove($comment->entity_id->target_id, $comment->getOwnerId(), $comment->changed->value);
_tracker_remove($comment->entity_id->value, $comment->getOwnerId(), $comment->changed->value);
}
}
......@@ -219,7 +219,7 @@ function tracker_comment_update(CommentInterface $comment) {
*/
function tracker_comment_publish(CommentInterface $comment) {
if ($comment->entity_type->value == 'node') {
_tracker_add($comment->entity_id->target_id, $comment->getOwnerId(), $comment->changed->value);
_tracker_add($comment->entity_id->value, $comment->getOwnerId(), $comment->changed->value);
}
}
......@@ -228,7 +228,7 @@ function tracker_comment_publish(CommentInterface $comment) {
*/
function tracker_comment_unpublish(CommentInterface $comment) {
if ($comment->entity_type->value == 'node') {
_tracker_remove($comment->entity_id->target_id, $comment->getOwnerId(), $comment->changed->value);
_tracker_remove($comment->entity_id->value, $comment->getOwnerId(), $comment->changed->value);
}
}
......@@ -237,7 +237,7 @@ function tracker_comment_unpublish(CommentInterface $comment) {
*/
function tracker_comment_delete(CommentInterface $comment) {
if ($comment->entity_type->value == 'node') {
_tracker_remove($comment->entity_id->target_id, $comment->getOwnerId(), $comment->changed->value);
_tracker_remove($comment->entity_id->value, $comment->getOwnerId(), $comment->changed->value);
}
}
......
......@@ -14,6 +14,13 @@
*/
class UserCancelTest extends WebTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array('node');
public static function getInfo() {
return array(
'name' => 'Cancel account',
......
......@@ -27,9 +27,9 @@ public static function getInfo() {
*/
function testUserDeleteMultiple() {
// Create a few users with permissions, so roles will be created.
$user_a = $this->drupalCreateUser(array('access content'));
$user_b = $this->drupalCreateUser(array('access content'));
$user_c = $this->drupalCreateUser(array('access content'));
$user_a = $this->drupalCreateUser(array('access user profiles'));
$user_b = $this->drupalCreateUser(array('access user profiles'));
$user_c = $this->drupalCreateUser(array('access user profiles'));
$uids = array($user_a->id(), $user_b->id(), $user_c->id());
......
......@@ -46,14 +46,14 @@ function testUserPermissionChanges() {
$this->assertIdentical($previous_permissions_hash, $permissions_hash_generator->generate($this->loggedInUser));
// Add a permission.
$this->assertFalse($account->hasPermission('administer nodes'), 'User does not have "administer nodes" permission.');
$this->assertFalse($account->hasPermission('administer users'), 'User does not have "administer users" permission.');
$edit = array();
$edit[$rid . '[administer nodes]'] = TRUE;
$edit[$rid . '[administer users]'] = TRUE;
$this->drupalPostForm('admin/people/permissions', $edit, t('Save permissions'));
$this->assertText(t('The changes have been saved.'), 'Successful save message displayed.');
$storage_controller = $this->container->get('entity.manager')->getStorageController('user_role');
$storage_controller->resetCache();
$this->assertTrue($account->hasPermission('administer nodes'), 'User now has "administer nodes" permission.');
$this->assertTrue($account->hasPermission('administer users'), 'User now has "administer users" permission.');
$current_permissions_hash = $permissions_hash_generator->generate($account);
$this->assertIdentical($current_permissions_hash, $permissions_hash_generator->generate($this->loggedInUser));
$this->assertNotEqual($previous_permissions_hash, $current_permissions_hash, 'Permissions hash has changed.');
......@@ -105,19 +105,19 @@ function testUserRoleChangePermissions() {
$previous_permissions_hash = $permissions_hash_generator->generate($account);
// Verify current permissions.
$this->assertFalse($account->hasPermission('administer nodes'), 'User does not have "administer nodes" permission.');
$this->assertFalse($account->hasPermission('administer users'), 'User does not have "administer users" permission.');
$this->assertTrue($account->hasPermission('access user profiles'), 'User has "access user profiles" permission.');
$this->assertTrue($account->hasPermission('administer site configuration'), 'User has "administer site configuration" permission.');
// Change permissions.
$permissions = array(
'administer nodes' => 1,