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
15 class FieldSchemaDataUninstallUpdateTest extends UpdatePathTestBase {
20 protected function setDatabaseDumpFiles() {
21 $this->databaseDumpFiles = [
22 __DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.bare.standard.php.gz',
23 __DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.block-content-uninstall.php',
24 __DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.field-schema-data-uninstall-2573667.php',
29 * Tests the upgrade path after fixing field schema data uninstallation.
31 public function testUpdateHookN() {
32 $this->assertFieldSchemaData(TRUE, 'Field schema data to be purged found before update.');
34 $this->assertFieldSchemaData(FALSE, 'No field schema data to be purged found after update.');
38 * Asserts that field schema data to be purged is found.
41 * Whether field schema data is expected to be found or not.
42 * @param string $message
46 * TRUE if the assertion succeeded, FALSE otherwise.
48 protected function assertFieldSchemaData($found, $message) {
49 $query = \Drupal::database()
50 ->select('key_value', 'kv')
53 ->condition('kv.collection', 'entity.storage_schema.sql')
54 ->condition('kv.name', 'block_content.field_schema_data.%', 'LIKE');
59 return $this->assertEqual((bool) $items, $found, $message);