diff -u b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php --- b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php +++ b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php @@ -102,7 +102,13 @@ } /** - * @return \Drupal\Core\State\StateInterface + * Returns the keyvalue collection for tracking the installed schema. + * + * @return \Drupal\Core\KeyValueStore\KeyValueStoreInterface + * + * @todo Inject this dependency in the constructor once this class can be + * instantiated as a regular entity handler: + * https://www.drupal.org/node/2332857. */ protected function installedStorageSchema() { if (!isset($this->installedStorageSchema)) { diff -u b/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageSchemaTest.php b/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageSchemaTest.php --- b/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageSchemaTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageSchemaTest.php @@ -1027,7 +1027,15 @@ ->method('schema') ->will($this->returnValue($db_schema_handler)); - $this->storageSchema = new SqlContentEntityStorageSchema($this->entityManager, $this->entityType, $this->storage, $connection); + $key_value = $this->getMock('Drupal\Core\KeyValueStore\KeyValueStoreInterface'); + $this->storageSchema = $this->getMockBuilder('Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema') + ->setConstructorArgs(array($this->entityManager, $this->entityType, $this->storage, $connection)) + ->setMethods(array('installedStorageSchema')) + ->getMock(); + $this->storageSchema + ->expects($this->any()) + ->method('installedStorageSchema') + ->will($this->returnValue($key_value)); } /** diff -u b/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php b/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php --- b/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php +++ b/core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageTest.php @@ -338,7 +338,15 @@ ->setMethods(array('getStorageSchema')) ->getMock(); - $schema_handler = new SqlContentEntityStorageSchema($this->entityManager, $this->entityType, $storage, $this->connection); + $key_value = $this->getMock('Drupal\Core\KeyValueStore\KeyValueStoreInterface'); + $schema_handler = $this->getMockBuilder('Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema') + ->setConstructorArgs(array($this->entityManager, $this->entityType, $storage, $this->connection)) + ->setMethods(array('installedStorageSchema')) + ->getMock(); + $schema_handler + ->expects($this->any()) + ->method('installedStorageSchema') + ->will($this->returnValue($key_value)); $storage ->expects($this->any())