/** * @covers ::requiresEntityStorageSchemaChanges * * @dataProvider providerTestRequiresEntityStorageSchemaChanges */ public function testRequiresEntityStorageSchemaChanges(ContentEntityTypeInterface $updated, ContentEntityTypeInterface $original, $requires_change, $change_schema, $change_shared_table) { $this->entityType = new ContentEntityType(array('id' => 'entity_test', 'entity_keys' => array('id' => 'id'))); $this->setUpStorageSchema(); $table_mapping = new DefaultTableMapping($this->entityType, $this->storageDefinitions); $table_mapping->setFieldNames('entity_test', array_keys($this->storageDefinitions)); $table_mapping->setExtraColumns('entity_test', array('default_langcode')); $this->storage->expects($this->any())->method('getTableMapping')->will($this->returnValue($table_mapping)); // Setup storage schema. if ($change_schema) { $this->storageSchema->expects($this->once())->method('loadEntitySchemaData')->willReturn(array()); } else { $expected = ['entity_test' => ['primary key' => ['id']]]; $this->storageSchema->expects($this->any())->method('loadEntitySchemaData')->willReturn($expected); } if ($change_shared_table) { $this->storageSchema->expects($this->once())->method('hasSharedTableNameChanges')->willReturn(TRUE); } $this->assertEquals($requires_change, $this->storageSchema->requiresEntityStorageSchemaChanges($updated, $original)); }