SqlContentEntityStorageSchemaIndexTest.php in Drupal 8
File
core/modules/system/tests/src/Functional/Entity/Update/SqlContentEntityStorageSchemaIndexTest.php
View source
<?php
namespace Drupal\Tests\system\Functional\Entity\Update;
use Drupal\Core\Database\Database;
use Drupal\FunctionalTests\Update\UpdatePathTestBase;
class SqlContentEntityStorageSchemaIndexTest extends UpdatePathTestBase {
protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [
__DIR__ . '/../../../../fixtures/update/drupal-8.bare.standard.php.gz',
];
}
public function testIndex() {
$schema = Database::getConnection()
->schema();
$this
->assertTrue($schema
->indexExists('node_field_data', 'node__default_langcode'), 'Index node__default_langcode exists prior to running updates.');
$this
->assertFalse($schema
->indexExists('node_field_data', 'node__id__default_langcode__langcode'), 'Index node__id__default_langcode__langcode does not exist prior to running updates.');
$this
->assertFalse($schema
->indexExists('users_field_data', 'user__id__default_langcode__langcode'), 'Index users__id__default_langcode__langcode does not exist prior to running updates.');
$this
->runUpdates();
$this
->assertFalse($schema
->indexExists('node_field_data', 'node__default_langcode'), 'Index node__default_langcode properly removed.');
$this
->assertTrue($schema
->indexExists('node_field_data', 'node__id__default_langcode__langcode'), 'Index node__id__default_langcode__langcode properly created on the node_field_data table.');
$this
->assertTrue($schema
->indexExists('users_field_data', 'user__id__default_langcode__langcode'), 'Index users__id__default_langcode__langcode properly created on the user_field_data table.');
}
}