Issue #2665216 by andypost, gidarai, daffie, mondrake, _utsavsharma, dawehner, catch, longwave, alexpott, Charlie ChX Negyesi: Deprecate Drupal\Core\Database\Connection::nextId() and the {sequences} table and schema

merge-requests/4085/merge
catch 2023-06-08 12:59:56 +01:00
parent b455418579
commit 6204ba9c59
111 changed files with 63 additions and 124 deletions

View File

@ -1663,6 +1663,11 @@ abstract class Connection {
* @return int|string
* An integer number larger than any number returned by earlier calls and
* also larger than the $existing_id if one was passed in.
*
* @deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. Modules
* should use instead the keyvalue storage for the last used id.
*
* @see https://www.drupal.org/node/3349345
*/
abstract public function nextId($existing_id = 0);

View File

@ -59,7 +59,6 @@ class BlockContentAccessHandlerTest extends KernelTestBase {
*/
protected function setUp(): void {
parent::setUp();
$this->installSchema('system', ['sequences']);
$this->installSchema('user', ['users_data']);
$this->installEntitySchema('user');
$this->installEntitySchema('block_content');

View File

@ -67,7 +67,6 @@ class BlockContentEntityReferenceSelectionTest extends KernelTestBase {
*/
protected function setUp(): void {
parent::setUp();
$this->installSchema('system', ['sequences']);
$this->installEntitySchema('user');
$this->installEntitySchema('block_content');

View File

@ -37,7 +37,6 @@ class BlockContentPermissionsTest extends KernelTestBase {
*/
public function setUp(): void {
parent::setUp();
$this->installSchema('system', ['sequences']);
$this->installEntitySchema('user');
$this->installEntitySchema('block_content');

View File

@ -85,7 +85,6 @@ class BookMultilingualTest extends KernelTestBase {
$this->installEntitySchema('user');
$this->installSchema('book', ['book']);
$this->installSchema('node', ['node_access']);
$this->installSchema('system', ['sequences']);
$this->installConfig(['node', 'book', 'field']);
$node_type = NodeType::create([
'type' => $this->randomMachineName(),

View File

@ -33,7 +33,6 @@ class CommentBaseFieldTest extends KernelTestBase {
parent::setUp();
$this->installEntitySchema('comment_test_base_field');
$this->installEntitySchema('comment');
$this->installSchema('system', ['sequences']);
$this->installEntitySchema('user');
}

View File

@ -42,7 +42,6 @@ class CommentIntegrationTest extends KernelTestBase {
$this->installEntitySchema('user');
$this->installEntitySchema('comment');
$this->installSchema('dblog', ['watchdog']);
$this->installSchema('system', ['sequences']);
// Create a new 'comment' comment-type.
CommentType::create([

View File

@ -28,7 +28,6 @@ class MigrateCommentStubTest extends MigrateDrupalTestBase {
parent::setUp();
$this->installEntitySchema('comment');
$this->installEntitySchema('node');
$this->installSchema('system', ['sequences']);
// Make sure uid 0 is created (default uid for comments is 0).
$storage = \Drupal::entityTypeManager()->getStorage('user');

View File

@ -57,7 +57,6 @@ class CommentFieldNameTest extends KernelTestBase {
$this->installEntitySchema('user');
$this->installEntitySchema('node');
$this->installEntitySchema('comment');
$this->installSchema('system', ['sequences']);
$this->installSchema('comment', ['comment_entity_statistics']);
$this->installConfig(['filter']);

View File

@ -52,7 +52,6 @@ class FilterAndArgumentUserUidTest extends KernelTestBase {
*/
public function testHandlers() {
$this->installEntitySchema('user');
$this->installSchema('system', ['sequences']);
$this->installEntitySchema('node');
$this->installEntitySchema('comment');
$this->installSchema('comment', ['comment_entity_statistics']);

View File

@ -44,7 +44,6 @@ class ContentModerationAccessTest extends KernelTestBase {
$this->installEntitySchema('node');
$this->installEntitySchema('user');
$this->installConfig(['content_moderation', 'filter']);
$this->installSchema('system', ['sequences']);
$this->installSchema('node', ['node_access']);
// Add a moderated node type.

View File

@ -49,7 +49,6 @@ class EntityStateChangeValidationTest extends KernelTestBase {
$this->installEntitySchema('user');
$this->installEntitySchema('content_moderation_state');
$this->installConfig('content_moderation');
$this->installSchema('system', ['sequences']);
$this->adminUser = $this->createUser(array_keys($this->container->get('user.permissions')->getPermissions()));
}

View File

@ -44,7 +44,6 @@ class ModerationStateFieldItemListTest extends KernelTestBase {
parent::setUp();
$this->installSchema('node', 'node_access');
$this->installSchema('system', 'sequences');
$this->installEntitySchema('node');
$this->installEntitySchema('user');
$this->installEntitySchema('content_moderation_state');

View File

@ -49,7 +49,6 @@ class NodeAccessTest extends KernelTestBase {
$this->installEntitySchema('node');
$this->installEntitySchema('user');
$this->installConfig(['content_moderation', 'filter']);
$this->installSchema('system', ['sequences']);
$this->installSchema('node', ['node_access']);
// Add a moderated node type.

View File

@ -43,8 +43,6 @@ class WorkspacesContentModerationStateTest extends ContentModerationStateTest {
protected function setUp(): void {
parent::setUp();
$this->installSchema('system', ['sequences']);
$this->initializeWorkspacesModule();
$this->switchToWorkspace('stage');
}

View File

@ -32,14 +32,6 @@ class DateTimeFormInjectionTest extends KernelTestBase implements FormInterface
*/
protected static $modules = ['system', 'datetime'];
/**
* {@inheritdoc}
*/
protected function setUp(): void {
parent::setUp();
$this->installSchema('system', ['sequences']);
}
/**
* {@inheritdoc}
*/

View File

@ -54,7 +54,6 @@ class SeparatorTranslationTest extends KernelTestBase {
$this->installEntitySchema('entity_test');
$this->installEntitySchema('user');
$this->installConfig(['system']);
$this->installSchema('system', ['sequences']);
// Add a datetime range field.
$this->fieldStorage = FieldStorageConfig::create([

View File

@ -78,7 +78,6 @@ class DbLogFormInjectionTest extends KernelTestBase implements FormInterface {
protected function setUp(): void {
parent::setUp();
$this->installSchema('dblog', ['watchdog']);
$this->installSchema('system', ['sequences']);
$this->installEntitySchema('user');
$this->logger = \Drupal::logger('test_logger');
$test_user = User::create([

View File

@ -28,7 +28,6 @@ class DbLogTest extends KernelTestBase {
parent::setUp();
$this->installSchema('dblog', ['watchdog']);
$this->installSchema('system', ['sequences']);
$this->installConfig(['system']);
}

View File

@ -59,7 +59,6 @@ abstract class FieldKernelTestBase extends KernelTestBase {
$this->installEntitySchema('entity_test');
$this->installEntitySchema('user');
$this->installSchema('system', ['sequences']);
// Set default storage backend and configure the theme system.
$this->installConfig(['field', 'system']);

View File

@ -36,7 +36,6 @@ class MigrateFieldInstanceLabelDescriptionTest extends MigrateDrupal6TestBase im
$this->installEntitySchema('node');
$this->installConfig(['node']);
$this->installSchema('node', ['node_access']);
$this->installSchema('system', ['sequences']);
$this->executeMigration('language');
$this->executeMigration('d6_field_instance_label_description_translation');
}

View File

@ -34,7 +34,6 @@ class AccessTest extends KernelTestBase {
$this->installEntitySchema('file');
$this->installEntitySchema('user');
$this->installSchema('file', ['file_usage']);
$this->installSchema('system', 'sequences');
}
/**

View File

@ -46,7 +46,6 @@ class FileItemValidationTest extends KernelTestBase {
$this->installEntitySchema('user');
$this->installEntitySchema('file');
$this->installSchema('file', 'file_usage');
$this->installSchema('system', 'sequences');
$this->user = User::create([
'name' => 'username',

View File

@ -31,7 +31,6 @@ class FileManagedAccessTest extends KernelTestBase {
* Tests if public file is always accessible.
*/
public function testFileAccess() {
$this->installSchema('system', ['sequences']);
$this->installEntitySchema('user');
$this->installEntitySchema('file');
$this->installSchema('file', ['file_usage']);

View File

@ -42,7 +42,6 @@ class TextFormatElementFormTest extends KernelTestBase implements FormInterface
protected function setUp(): void {
parent::setUp();
$this->installEntitySchema('user');
$this->installSchema('system', ['sequences']);
$this->installConfig(['filter', 'filter_test']);
// Create user 1 so that the user created later in the test has a different

View File

@ -106,7 +106,6 @@ class EntityResourceTest extends JsonapiKernelTestBase {
$this->installEntitySchema('node');
$this->installEntitySchema('user');
// Add the additional table schemas.
$this->installSchema('system', ['sequences']);
$this->installSchema('node', ['node_access']);
$this->installSchema('user', ['users_data']);
NodeType::create([

View File

@ -37,7 +37,6 @@ class TemporaryJsonapiFileFieldUploaderTest extends JsonapiKernelTestBase {
$this->installEntitySchema('node');
$this->installEntitySchema('user');
// Add the additional table schemas.
$this->installSchema('system', ['sequences']);
$this->installSchema('node', ['node_access']);
$this->installSchema('user', ['users_data']);
NodeType::create([

View File

@ -61,7 +61,6 @@ class ResourceObjectNormalizerCacherTest extends KernelTestBase {
// Add the entity schemas.
$this->installEntitySchema('user');
// Add the additional table schemas.
$this->installSchema('system', ['sequences']);
$this->installSchema('user', ['users_data']);
$this->resourceTypeRepository = $this->container->get('jsonapi.resource_type.repository');
$this->serializer = $this->container->get('jsonapi.serializer');

View File

@ -135,7 +135,6 @@ class JsonApiDocumentTopLevelNormalizerTest extends JsonapiKernelTestBase {
$this->installEntitySchema('taxonomy_term');
$this->installEntitySchema('file');
// Add the additional table schemas.
$this->installSchema('system', ['sequences']);
$this->installSchema('node', ['node_access']);
$this->installSchema('user', ['users_data']);
$this->installSchema('file', ['file_usage']);

View File

@ -63,7 +63,6 @@ class LinkCollectionNormalizerTest extends KernelTestBase {
// Add the entity schemas.
$this->installEntitySchema('user');
// Add the additional table schemas.
$this->installSchema('system', ['sequences']);
$this->installSchema('user', ['users_data']);
// Set the user IDs to something higher than 1 so these users cannot be
// mistaken for the site admin.

View File

@ -150,7 +150,6 @@ class RelationshipNormalizerTest extends JsonapiKernelTestBase {
$this->installEntitySchema('file');
// Add the additional table schemas.
$this->installSchema('system', ['sequences']);
$this->installSchema('node', ['node_access']);
$this->installSchema('file', ['file_usage']);
NodeType::create([

View File

@ -270,7 +270,6 @@ class FilterTest extends JsonapiKernelTestBase {
* Sets up the schemas.
*/
protected function setUpSchemas() {
$this->installSchema('system', ['sequences']);
$this->installSchema('node', ['node_access']);
$this->installSchema('user', ['users_data']);

View File

@ -58,7 +58,6 @@ class RelatedResourceTypesTest extends JsonapiKernelTestBase {
$this->installEntitySchema('user');
// Add the additional table schemas.
$this->installSchema('system', ['sequences']);
$this->installSchema('node', ['node_access']);
$this->installSchema('user', ['users_data']);

View File

@ -43,7 +43,6 @@ class ResourceTypeRepositoryTest extends JsonapiKernelTestBase {
$this->installEntitySchema('node');
$this->installEntitySchema('user');
// Add the additional table schemas.
$this->installSchema('system', ['sequences']);
$this->installSchema('node', ['node_access']);
$this->installSchema('user', ['users_data']);
NodeType::create([

View File

@ -75,7 +75,6 @@ class VersionNegotiatorTest extends JsonapiKernelTestBase {
$this->installEntitySchema('node');
$this->installEntitySchema('user');
// Add the additional table schemas.
$this->installSchema('system', ['sequences']);
$this->installSchema('node', ['node_access']);
$this->installSchema('user', ['users_data']);
$type = NodeType::create([

View File

@ -72,7 +72,6 @@ class SerializerTest extends JsonapiKernelTestBase {
$this->installEntitySchema('node');
$this->installEntitySchema('user');
// Add the additional table schemas.
$this->installSchema('system', ['sequences']);
$this->installSchema('node', ['node_access']);
$this->installSchema('user', ['users_data']);
$this->user = User::create([

View File

@ -71,7 +71,6 @@ abstract class MediaEmbedFilterTestBase extends KernelTestBase {
parent::setUp();
$this->installSchema('file', ['file_usage']);
$this->installSchema('system', 'sequences');
$this->installEntitySchema('file');
$this->installEntitySchema('media');
$this->installEntitySchema('user');

View File

@ -62,7 +62,6 @@ abstract class MediaKernelTestBase extends KernelTestBase {
$this->installEntitySchema('user');
$this->installEntitySchema('file');
$this->installSchema('file', 'file_usage');
$this->installSchema('system', 'sequences');
$this->installEntitySchema('media');
$this->installConfig(['field', 'system', 'image', 'file', 'media']);

View File

@ -51,7 +51,6 @@ class MediaLibraryAccessTest extends KernelTestBase {
$this->installEntitySchema('user');
$this->installEntitySchema('file');
$this->installSchema('file', 'file_usage');
$this->installSchema('system', ['sequences']);
$this->installEntitySchema('entity_test');
$this->installEntitySchema('filter_format');
$this->installEntitySchema('media');

View File

@ -44,7 +44,6 @@ class MediaLibraryAddFormTest extends KernelTestBase {
$this->installEntitySchema('user');
$this->installEntitySchema('file');
$this->installSchema('file', 'file_usage');
$this->installSchema('system', ['sequences']);
$this->installEntitySchema('media');
$this->installConfig([
'field',

View File

@ -44,7 +44,6 @@ class MediaLibraryStateTest extends KernelTestBase {
$this->installEntitySchema('user');
$this->installEntitySchema('file');
$this->installSchema('file', 'file_usage');
$this->installSchema('system', 'sequences');
$this->installEntitySchema('media');
$this->installConfig([
'field',

View File

@ -70,7 +70,6 @@ class MediaLibraryWidgetTest extends KernelTestBase {
$this->installEntitySchema('entity_test');
$this->installEntitySchema('entity_test_rev');
$this->installEntitySchema('user');
$this->installSchema('system', ['sequences']);
$this->installConfig([
'system',
'image',

View File

@ -44,7 +44,6 @@ class MenuLinksTest extends KernelTestBase {
$this->menuLinkManager = \Drupal::service('plugin.manager.menu.link');
$this->installSchema('system', ['sequences']);
$this->installSchema('user', ['users_data']);
$this->installEntitySchema('entity_test_external');
$this->installEntitySchema('menu_link_content');

View File

@ -52,7 +52,6 @@ class MigrateEntityContentValidationTest extends KernelTestBase {
$this->installEntitySchema('user');
$this->installEntitySchema('user_role');
$this->installEntitySchema('entity_test');
$this->installSchema('system', ['sequences']);
$this->installConfig(['field', 'filter_test', 'system', 'user']);
$this->container

View File

@ -33,7 +33,6 @@ class MigrateExternalTranslatedTest extends MigrateTestBase {
*/
protected function setUp(): void {
parent::setUp();
$this->installSchema('system', ['sequences']);
$this->installSchema('node', ['node_access']);
$this->installEntitySchema('user');
$this->installEntitySchema('node');

View File

@ -24,7 +24,6 @@ class EntityExistsTest extends KernelTestBase {
*/
protected function setUp(): void {
parent::setUp();
$this->installSchema('system', ['sequences']);
$this->installEntitySchema('user');
}

View File

@ -94,7 +94,6 @@ class ContentEntityTest extends KernelTestBase {
$this->installEntitySchema('media');
$this->installEntitySchema('taxonomy_term');
$this->installEntitySchema('user');
$this->installSchema('system', ['sequences']);
$this->installSchema('user', 'users_data');
$this->installSchema('file', 'file_usage');
$this->installSchema('node', ['node_access']);

View File

@ -39,7 +39,6 @@ class MigrateDrupal6AuditIdsTest extends MigrateDrupal6TestBase {
$this->installSchema('forum', ['forum_index']);
$this->installSchema('node', ['node_access']);
$this->installSchema('search', ['search_dataset']);
$this->installSchema('system', ['sequences']);
// @todo Remove tracker in https://www.drupal.org/project/drupal/issues/3261452
$this->installSchema('tracker', ['tracker_node', 'tracker_user']);

View File

@ -39,7 +39,6 @@ class MigrateDrupal7AuditIdsTest extends MigrateDrupal7TestBase {
$this->installSchema('forum', ['forum_index']);
$this->installSchema('node', ['node_access']);
$this->installSchema('search', ['search_dataset']);
$this->installSchema('system', ['sequences']);
// @todo Remove tracker in https://www.drupal.org/project/drupal/issues/3261452
$this->installSchema('tracker', ['tracker_node', 'tracker_user']);

View File

@ -62,6 +62,11 @@ class Connection extends DatabaseConnection implements SupportsTemporaryTablesIn
* Flag to indicate if the cleanup function in __destruct() should run.
*
* @var bool
*
* @deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. There's no
* replacement.
*
* @see https://www.drupal.org/node/3349345
*/
protected $needsCleanup = FALSE;
@ -354,7 +359,11 @@ class Connection extends DatabaseConnection implements SupportsTemporaryTablesIn
return NULL;
}
/**
* {@inheritdoc}
*/
public function nextId($existing_id = 0) {
@trigger_error('Drupal\Core\Database\Connection::nextId() is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. Modules should use instead the keyvalue storage for the last used id. See https://www.drupal.org/node/3349345', E_USER_DEPRECATED);
$this->query('INSERT INTO {sequences} () VALUES ()');
$new_id = $this->lastInsertId();
// This should only happen after an import or similar event.
@ -375,6 +384,7 @@ class Connection extends DatabaseConnection implements SupportsTemporaryTablesIn
}
public function nextIdDelete() {
@trigger_error(__METHOD__ . '() is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. Modules should use instead the keyvalue storage for the last used id. See https://www.drupal.org/node/3349345', E_USER_DEPRECATED);
// While we want to clean up the table to keep it up from occupying too
// much storage and memory, we must keep the highest value in the table
// because InnoDB uses an in-memory auto-increment counter as long as the

View File

@ -92,7 +92,6 @@ class DbDumpTest extends DriverSpecificKernelTestBase {
$this->installEntitySchema('file');
$this->installEntitySchema('menu_link_content');
$this->installEntitySchema('path_alias');
$this->installSchema('system', 'sequences');
// Place some sample config to test for in the export.
$this->data = [
@ -130,7 +129,6 @@ class DbDumpTest extends DriverSpecificKernelTestBase {
'menu_link_content_data',
'menu_link_content_revision',
'menu_link_content_field_revision',
'sequences',
'sessions',
'path_alias',
'path_alias_revision',

View File

@ -9,6 +9,7 @@ use Drupal\KernelTests\Core\Database\DriverSpecificDatabaseTestBase;
* Tests the sequences API.
*
* @group Database
* @group legacy
*/
class NextIdTest extends DriverSpecificDatabaseTestBase {
@ -24,7 +25,20 @@ class NextIdTest extends DriverSpecificDatabaseTestBase {
*/
protected function setUp(): void {
parent::setUp();
$this->installSchema('system', 'sequences');
$table_specification = [
'description' => 'Stores IDs.',
'fields' => [
'value' => [
'description' => 'The value of the sequence.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
],
],
'primary key' => ['value'],
];
$this->connection->schema()->createTable('sequences', $table_specification);
}
/**
@ -33,6 +47,9 @@ class NextIdTest extends DriverSpecificDatabaseTestBase {
* @see \Drupal\mysql\Driver\Database\mysql\Connection::__destruct()
*/
public function testDbNextIdClosedConnection() {
$this->expectDeprecation('Drupal\Core\Database\Connection::nextId() is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. Modules should use instead the keyvalue storage for the last used id. See https://www.drupal.org/node/3349345');
$this->expectDeprecation('Drupal\mysql\Driver\Database\mysql\Connection::nextIdDelete() is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. Modules should use instead the keyvalue storage for the last used id. See https://www.drupal.org/node/3349345');
// Create an additional connection to test closing the connection.
$connection_info = Database::getConnectionInfo();
Database::addConnectionInfo('default', 'next_id', $connection_info['default']);

View File

@ -19,7 +19,6 @@ abstract class MigrateNodeTestBase extends MigrateDrupal6TestBase {
$this->installEntitySchema('node');
$this->installConfig(['node']);
$this->installSchema('node', ['node_access']);
$this->installSchema('system', ['sequences']);
// Create a new user which needs to have UID 1, because that is expected by
// the assertions from

View File

@ -62,7 +62,6 @@ class MigrateNodeCompleteTest extends MigrateDrupal7TestBase {
$this->installEntitySchema('taxonomy_term');
$this->installSchema('comment', ['comment_entity_statistics']);
$this->installSchema('node', ['node_access']);
$this->installSchema('system', ['sequences']);
$this->createContent();

View File

@ -54,7 +54,6 @@ abstract class NodeAccessTestBase extends KernelTestBase {
*/
protected function setUp(): void {
parent::setUp();
$this->installSchema('system', 'sequences');
$this->installSchema('node', 'node_access');
$this->installEntitySchema('user');
$this->installEntitySchema('node');

View File

@ -33,7 +33,6 @@ class NodeBodyFieldStorageTest extends KernelTestBase {
*/
protected function setUp(): void {
parent::setUp();
$this->installSchema('system', 'sequences');
// Necessary for module uninstall.
$this->installSchema('user', 'users_data');
$this->installEntitySchema('user');

View File

@ -51,7 +51,6 @@ class SummaryLengthTest extends KernelTestBase {
*/
protected function setUp(): void {
parent::setUp();
$this->installSchema('system', 'sequences');
$this->installSchema('node', 'node_access');
$this->installEntitySchema('user');
$this->installEntitySchema('node');

View File

@ -45,7 +45,6 @@ class FilterUidRevisionTest extends KernelTestBase {
public function testFilter() {
$this->installEntitySchema('user');
$this->installEntitySchema('node');
$this->installSchema('system', ['sequences']);
$this->installSchema('node', ['node_access']);
$this->installConfig(['filter']);
ViewTestData::createTestViews(static::class, ['node_test_views']);

View File

@ -298,7 +298,7 @@ class Connection extends DatabaseConnection implements SupportsTemporaryTablesIn
* and updating a sequences table.
*/
public function nextId($existing = 0) {
@trigger_error('Drupal\Core\Database\Connection::nextId() is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. Modules should use instead the keyvalue storage for the last used id. See https://www.drupal.org/node/3349345', E_USER_DEPRECATED);
// Retrieve the name of the sequence. This information cannot be cached
// because the prefix may change, for example, like it does in tests.
$sequence_name = $this->makeSequenceName('sequences', 'value');

View File

@ -76,9 +76,6 @@ class EntitySerializationTest extends NormalizerTestBase {
protected function setUp(): void {
parent::setUp();
// User create needs sequence table.
$this->installSchema('system', ['sequences']);
FilterFormat::create([
'format' => 'my_text_format',
'name' => 'My Text Format',

View File

@ -416,7 +416,11 @@ class Connection extends DatabaseConnection implements SupportsTemporaryTablesIn
return $statement;
}
/**
* {@inheritdoc}
*/
public function nextId($existing_id = 0) {
@trigger_error('Drupal\Core\Database\Connection::nextId() is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. Modules should use instead the keyvalue storage for the last used id. See https://www.drupal.org/node/3349345', E_USER_DEPRECATED);
try {
$this->startTransaction();
}

View File

@ -1590,6 +1590,9 @@ function system_install() {
* Implements hook_schema().
*/
function system_schema() {
// @deprecated The sequences table has been deprecated in drupal:10.2.0 and is
// removed from drupal:12.0.0. See https://www.drupal.org/node/3220378.
// @todo: Remove sequences table in Drupal 12. See https://www.drupal.org/i/3335756
$schema['sequences'] = [
'description' => 'Stores IDs.',
'fields' => [

View File

@ -55,7 +55,6 @@ class EntityReferenceSelectionAccessTest extends KernelTestBase {
protected function setUp(): void {
parent::setUp();
$this->installSchema('system', 'sequences');
$this->installSchema('comment', ['comment_entity_statistics']);
$this->installSchema('file', ['file_usage']);

View File

@ -34,7 +34,6 @@ class ActionTest extends KernelTestBase {
$this->actionManager = $this->container->get('plugin.manager.action');
$this->installEntitySchema('user');
$this->installSchema('system', ['sequences']);
}
/**

View File

@ -82,7 +82,6 @@ class SystemMenuBlockTest extends KernelTestBase {
*/
protected function setUp(): void {
parent::setUp();
$this->installSchema('system', 'sequences');
$this->installEntitySchema('user');
$this->installEntitySchema('menu_link_content');

View File

@ -43,7 +43,6 @@ class DateFormatAccessControlHandlerTest extends KernelTestBase {
protected function setUp(): void {
parent::setUp();
$this->installEntitySchema('user');
$this->installSchema('system', 'sequences');
$this->accessControlHandler = $this->container->get('entity_type.manager')->getAccessControlHandler('date_format');
}

View File

@ -42,7 +42,6 @@ class MenuAccessControlHandlerTest extends KernelTestBase {
protected function setUp(): void {
parent::setUp();
$this->installEntitySchema('user');
$this->installSchema('system', 'sequences');
$this->accessControlHandler = $this->container->get('entity_type.manager')->getAccessControlHandler('menu');
}

View File

@ -29,7 +29,6 @@ class TimezoneResolverTest extends KernelTestBase {
*/
public function testGetTimeZone() {
$this->installEntitySchema('user');
$this->installSchema('system', ['sequences']);
$this->installConfig(['system']);
// Check the default test timezone.

View File

@ -33,7 +33,6 @@ class MigrateTermNodeTranslationTest extends MigrateDrupal6TestBase {
$this->installEntitySchema('node');
$this->installConfig(['node']);
$this->installSchema('node', ['node_access']);
$this->installSchema('system', ['sequences']);
$this->executeMigration('language');
$this->executeMigration('d6_node_settings');

View File

@ -45,7 +45,6 @@ class TrackerUserUidTest extends KernelTestBase {
* Tests the user uid filter and argument.
*/
public function testUserUid() {
$this->installSchema('system', ['sequences']);
$this->installConfig(['filter']);
$this->installEntitySchema('user');
$this->installEntitySchema('node');

View File

@ -56,7 +56,6 @@ class UserRoleConditionTest extends KernelTestBase {
protected function setUp(): void {
parent::setUp();
$this->installSchema('system', 'sequences');
$this->installEntitySchema('user');
$this->manager = $this->container->get('plugin.manager.condition');

View File

@ -24,7 +24,6 @@ class CurrentUserContextTest extends KernelTestBase {
protected function setUp(): void {
parent::setUp();
$this->installSchema('system', ['sequences']);
$this->installEntitySchema('user');
}

View File

@ -44,7 +44,6 @@ class UserNameFormatterTest extends KernelTestBase {
$this->installConfig(['field']);
$this->installEntitySchema('user');
$this->installSchema('system', ['sequences']);
$this->entityType = 'user';
$this->bundle = $this->entityType;

View File

@ -25,7 +25,6 @@ class MigrateUserStubTest extends MigrateDrupalTestBase {
protected function setUp(): void {
parent::setUp();
$this->installEntitySchema('user');
$this->installSchema('system', ['sequences']);
}
/**

View File

@ -34,7 +34,6 @@ class UserAccountFormPasswordResetTest extends KernelTestBase {
parent::setUp();
// Install default configuration; required for AccountFormController.
$this->installConfig(['user']);
$this->installSchema('system', ['sequences']);
$this->installEntitySchema('user');
// Create an user to login.

View File

@ -28,7 +28,6 @@ class UserDeleteTest extends KernelTestBase {
* Tests deleting multiple users.
*/
public function testUserDeleteMultiple() {
$this->installSchema('system', ['sequences']);
$this->installSchema('user', ['users_data']);
$this->installEntitySchema('user');

View File

@ -28,7 +28,6 @@ class UserEntityLabelTest extends KernelTestBase {
* Tests label callback.
*/
public function testLabelCallback() {
$this->installSchema('system', ['sequences']);
$this->installEntitySchema('user');
$account = $this->createUser();

View File

@ -24,7 +24,6 @@ class UserSaveTest extends KernelTestBase {
* Ensures that an existing password is unset after the user was saved.
*/
public function testExistingPasswordRemoval() {
$this->installSchema('system', ['sequences']);
$this->installEntitySchema('user');
/** @var \Drupal\user\Entity\User $user */

View File

@ -30,7 +30,6 @@ class UserValidationTest extends KernelTestBase {
protected function setUp(): void {
parent::setUp();
$this->installEntitySchema('user');
$this->installSchema('system', ['sequences']);
// Make sure that the default roles exist.
$this->installConfig(['user']);

View File

@ -56,7 +56,6 @@ class AccessPermissionTest extends KernelTestBase {
protected function setUp(): void {
parent::setUp();
$this->installSchema('system', ['sequences']);
$this->installEntitySchema('user');
$this->installEntitySchema('node');

View File

@ -38,7 +38,6 @@ class ArgumentDefaultTest extends KernelTestBase {
* Tests the current user with argument default.
*/
public function testPluginArgumentDefaultCurrentUser() {
$this->installSchema('system', ['sequences']);
$this->installEntitySchema('user');
ViewTestData::createTestViews(static::class, ['user_test_views']);

View File

@ -38,7 +38,6 @@ class HandlerArgumentUserUidTest extends KernelTestBase {
* Tests the generated title of a user: uid argument.
*/
public function testArgumentTitle() {
$this->installSchema('system', ['sequences']);
$this->installEntitySchema('user');
$this->installConfig(['user']);
User::create(['uid' => 0, 'name' => ''])->save();

View File

@ -43,7 +43,6 @@ class RelationshipRepresentativeNodeTest extends KernelTestBase {
* Tests the relationship.
*/
public function testRelationship() {
$this->installSchema('system', ['sequences']);
$this->installEntitySchema('user');
$this->installEntitySchema('node');
$this->installConfig(['filter']);

View File

@ -45,7 +45,6 @@ class WhosOnlineBlockTest extends KernelTestBase {
protected function setUp(): void {
parent::setUp();
$this->installConfig(['system', 'block', 'views', 'user']);
$this->installSchema('system', ['sequences']);
$this->installEntitySchema('user');
$this->controller = $this->container

View File

@ -4,7 +4,6 @@ namespace Drupal\Tests\user\Traits;
use Drupal\Component\Render\FormattableMarkup;
use Drupal\Core\Database\DatabaseExceptionWrapper;
use Drupal\Core\Database\SchemaObjectExistsException;
use Drupal\Core\Entity\EntityStorageException;
use Drupal\Core\Session\AccountInterface;
use Drupal\KernelTests\KernelTestBase;
@ -56,13 +55,6 @@ trait UserCreationTrait {
if (!\Drupal::moduleHandler()->moduleExists('system')) {
$values['uid'] = 0;
}
if ($this instanceof KernelTestBase && (!isset($values['uid']) || $values['uid'])) {
try {
$this->installSchema('system', ['sequences']);
}
catch (SchemaObjectExistsException $e) {
}
}
// Creating an administrator or assigning custom permissions would result in
// creating and assigning a new role to the user. This is not possible with

View File

@ -47,7 +47,6 @@ abstract class ViewsKernelTestBase extends KernelTestBase {
protected function setUp($import_test_views = TRUE): void {
parent::setUp();
$this->installSchema('system', ['sequences']);
$this->setUpFixtures();
if ($import_test_views) {

View File

@ -56,7 +56,6 @@ class WorkflowAccessControlHandlerTest extends KernelTestBase {
parent::setUp();
$this->installEntitySchema('user');
$this->installSchema('system', ['sequences']);
$this->accessControlHandler = $this->container->get('entity_type.manager')->getAccessControlHandler('workflow');

View File

@ -43,7 +43,6 @@ class EntityReferenceSupportedNewEntitiesConstraintValidatorTest extends KernelT
parent::setUp();
$this->installEntitySchema('user');
$this->installSchema('system', ['sequences']);
$this->createUser();
$fields['supported_reference'] = BaseFieldDefinition::create('entity_reference')->setSetting('target_type', 'entity_test_mulrevpub');

View File

@ -33,7 +33,6 @@ class WorkspaceAccessTest extends KernelTestBase {
protected function setUp(): void {
parent::setUp();
$this->installSchema('system', ['sequences']);
$this->installSchema('workspaces', ['workspace_association']);
$this->installEntitySchema('workspace');

View File

@ -58,7 +58,6 @@ class WorkspaceAssociationTest extends KernelTestBase {
$this->installConfig(['filter', 'node', 'system']);
$this->installSchema('node', ['node_access']);
$this->installSchema('system', ['sequences']);
$this->installSchema('workspaces', ['workspace_association']);
$this->createContentType(['type' => 'article']);

View File

@ -87,7 +87,6 @@ class WorkspaceIntegrationTest extends KernelTestBase {
$this->installConfig(['filter', 'node', 'system', 'language', 'content_translation']);
$this->installSchema('system', ['sequences']);
$this->installSchema('node', ['node_access']);
$language = ConfigurableLanguage::createFromLangcode('de');

View File

@ -61,7 +61,6 @@ class WorkspaceMergerTest extends KernelTestBase {
$this->installConfig(['filter', 'node', 'system']);
$this->installSchema('system', ['sequences']);
$this->installSchema('node', ['node_access']);
$this->createContentType(['type' => 'article']);

View File

@ -27,7 +27,6 @@ class DeleteActionTest extends KernelTestBase {
parent::setUp();
$this->installEntitySchema('entity_test_mulrevpub');
$this->installEntitySchema('user');
$this->installSchema('system', ['sequences']);
$this->testUser = User::create([
'name' => 'foobar',

View File

@ -29,7 +29,6 @@ class CacheContextOptimizationTest extends KernelTestBase {
parent::setUp();
$this->installEntitySchema('user');
$this->installConfig(['user']);
$this->installSchema('system', ['sequences']);
}
/**

View File

@ -34,7 +34,6 @@ class EndOfTransactionQueriesTest extends KernelTestBase {
protected function setUp(): void {
parent::setUp();
$this->installSchema('system', 'sequences');
$this->installEntitySchema('entity_test');
$this->installEntitySchema('user');

View File

@ -39,7 +39,6 @@ class ConfigImporterMissingContentTest extends KernelTestBase {
*/
protected function setUp(): void {
parent::setUp();
$this->installSchema('system', 'sequences');
$this->installEntitySchema('entity_test');
$this->installEntitySchema('user');
$this->installConfig(['system', 'config_test']);

View File

@ -6,6 +6,7 @@ namespace Drupal\KernelTests\Core\Database;
* Tests the sequences API.
*
* @group Database
* @group legacy
*/
class NextIdTest extends DatabaseTestBase {
@ -21,13 +22,28 @@ class NextIdTest extends DatabaseTestBase {
*/
protected function setUp(): void {
parent::setUp();
$this->installSchema('system', 'sequences');
$table_specification = [
'description' => 'Stores IDs.',
'fields' => [
'value' => [
'description' => 'The value of the sequence.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
],
],
'primary key' => ['value'],
];
$this->connection->schema()->createTable('sequences', $table_specification);
}
/**
* Tests that the sequences API works.
*/
public function testDbNextId() {
$this->expectDeprecation('Drupal\Core\Database\Connection::nextId() is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. Modules should use instead the keyvalue storage for the last used id. See https://www.drupal.org/node/3349345');
$first = $this->connection->nextId();
$second = $this->connection->nextId();
// We can test for exact increase in here because we know there is no

View File

@ -347,8 +347,6 @@ class SelectComplexTest extends DatabaseTestBase {
* Tests that we can join on a query.
*/
public function testJoinSubquery() {
$this->installSchema('system', 'sequences');
$account = User::create([
'name' => $this->randomMachineName(),
'mail' => $this->randomMachineName() . '@example.com',

View File

@ -37,7 +37,6 @@ class PathElementFormTest extends KernelTestBase implements FormInterface {
*/
protected function setUp(): void {
parent::setUp();
$this->installSchema('system', ['sequences']);
$this->installEntitySchema('user');
/** @var \Drupal\user\RoleInterface $role */
$role = Role::create([

View File

@ -32,7 +32,6 @@ class ContentEntityHasChangesTest extends KernelTestBase {
$this->installEntitySchema('user');
$this->installEntitySchema('entity_test_mulrev_changed_rev');
$this->installSchema('system', 'sequences');
}
/**

Some files were not shown because too many files have changed in this diff Show More