3 namespace Drupal\Tests\system\Functional\Update;
5 use Drupal\FunctionalTests\Update\UpdatePathTestBase;
8 * Tests the upgrade path after fixing field schema data uninstallation.
10 * @see https://www.drupal.org/node/2573667
14 class FieldSchemaDataUninstallUpdateTest extends UpdatePathTestBase {
19 protected function setDatabaseDumpFiles() {
20 $this->databaseDumpFiles = [
21 __DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.bare.standard.php.gz',
22 __DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.block-content-uninstall.php',
23 __DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.field-schema-data-uninstall-2573667.php',
28 * Tests the upgrade path after fixing field schema data uninstallation.
30 public function testUpdateHookN() {
31 $this->assertFieldSchemaData(TRUE, 'Field schema data to be purged found before update.');
33 $this->assertFieldSchemaData(FALSE, 'No field schema data to be purged found after update.');
37 * Asserts that field schema data to be purged is found.
40 * Whether field schema data is expected to be found or not.
41 * @param string $message
45 * TRUE if the assertion succeeded, FALSE otherwise.
47 protected function assertFieldSchemaData($found, $message) {
48 $query = \Drupal::database()
49 ->select('key_value', 'kv')
52 ->condition('kv.collection', 'entity.storage_schema.sql')
53 ->condition('kv.name', 'block_content.field_schema_data.%', 'LIKE');
58 return $this->assertEqual((bool) $items, $found, $message);