FieldSchemaDataUninstallUpdateTest.php in Zircon Profile 8
File
core/modules/system/src/Tests/Update/FieldSchemaDataUninstallUpdateTest.php
View source
<?php
namespace Drupal\system\Tests\Update;
class FieldSchemaDataUninstallUpdateTest extends UpdatePathTestBase {
protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [
__DIR__ . '/../../../../system/tests/fixtures/update/drupal-8.bare.standard.php.gz',
__DIR__ . '/../../../../system/tests/fixtures/update/drupal-8.block-content-uninstall.php',
__DIR__ . '/../../../../system/tests/fixtures/update/drupal-8.field-schema-data-uninstall-2573667.php',
];
}
public function testUpdateHookN() {
$this
->assertFieldSchemaData(TRUE, 'Field schema data to be purged found before update.');
$this
->runUpdates();
$this
->assertFieldSchemaData(FALSE, 'No field schema data to be purged found after update.');
}
protected function assertFieldSchemaData($found, $message) {
$query = \Drupal::database()
->select('key_value', 'kv')
->fields('kv');
$query
->condition('kv.collection', 'entity.storage_schema.sql')
->condition('kv.name', 'block_content.field_schema_data.%', 'LIKE');
$items = $query
->execute()
->fetchAll();
return $this
->assertEqual((bool) $items, $found, $message);
}
}