X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fblock_content%2Ftests%2Fsrc%2FFunctional%2FUpdate%2FBlockContentUpdateTest.php;fp=web%2Fcore%2Fmodules%2Fblock_content%2Ftests%2Fsrc%2FFunctional%2FUpdate%2FBlockContentUpdateTest.php;h=804bf386791dae481d19b15e5c31f97a01f45529;hp=0000000000000000000000000000000000000000;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hpb=aea91e65e895364e460983b890e295aa5d5540a5 diff --git a/web/core/modules/block_content/tests/src/Functional/Update/BlockContentUpdateTest.php b/web/core/modules/block_content/tests/src/Functional/Update/BlockContentUpdateTest.php new file mode 100644 index 000000000..804bf3867 --- /dev/null +++ b/web/core/modules/block_content/tests/src/Functional/Update/BlockContentUpdateTest.php @@ -0,0 +1,46 @@ +databaseDumpFiles = [ + __DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.bare.standard.php.gz', + ]; + } + + /** + * Tests the revision metadata fields and revision data table additions. + */ + public function testSimpleUpdates() { + $entity_definition_update_manager = \Drupal::entityDefinitionUpdateManager(); + $entity_type = $entity_definition_update_manager->getEntityType('block_content'); + $this->assertNull($entity_type->getRevisionDataTable()); + + $this->runUpdates(); + + $post_revision_created = $entity_definition_update_manager->getFieldStorageDefinition('revision_created', 'block_content'); + $post_revision_user = $entity_definition_update_manager->getFieldStorageDefinition('revision_user', 'block_content'); + $this->assertTrue($post_revision_created instanceof BaseFieldDefinition, "Revision created field found"); + $this->assertTrue($post_revision_user instanceof BaseFieldDefinition, "Revision user field found"); + + $this->assertEqual('created', $post_revision_created->getType(), "Field is type created"); + $this->assertEqual('entity_reference', $post_revision_user->getType(), "Field is type entity_reference"); + + $entity_type = $entity_definition_update_manager->getEntityType('block_content'); + $this->assertEqual('block_content_field_revision', $entity_type->getRevisionDataTable()); + } + +}