diff --git a/core/lib/Drupal/Core/Cache/RefinableCacheableDependencyTrait.php b/core/lib/Drupal/Core/Cache/RefinableCacheableDependencyTrait.php index 7a516ae..63b1d3d 100644 --- a/core/lib/Drupal/Core/Cache/RefinableCacheableDependencyTrait.php +++ b/core/lib/Drupal/Core/Cache/RefinableCacheableDependencyTrait.php @@ -40,12 +40,7 @@ public function addCacheableDependency($other_object) { if ($other_object instanceof CacheableDependencyInterface) { $this->addCacheContexts($other_object->getCacheContexts()); $this->addCacheTags($other_object->getCacheTags()); - if ($this->maxAge === Cache::PERMANENT) { - $this->maxAge = $other_object->getCacheMaxAge(); - } - elseif (($max_age = $other_object->getCacheMaxAge()) && $max_age !== Cache::PERMANENT) { - $this->maxAge = Cache::mergeMaxAges($this->maxAge, $max_age); - } + $this->mergeCacheMaxAge($other_object->getCacheMaxAge()); } else { // Not a cacheable dependency, this can not be cached. diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php b/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php index 7787185..401b19b 100644 --- a/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php +++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php @@ -14,7 +14,6 @@ use Drupal\Core\Entity\EntityMalformedException; use Drupal\Core\Entity\EntityStorageBase; use Drupal\Core\Config\Config; -use Drupal\Core\Config\StorageInterface; use Drupal\Core\Config\Entity\Exception\ConfigEntityIdLengthException; use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Component\Uuid\UuidInterface; @@ -184,7 +183,7 @@ protected function doLoadMultiple(array $ids = NULL) { } // Load all of the configuration entities. - /** @var Config[] $configs */ + /** @var \Drupal\Core\Config\Config[] $configs */ $configs = []; $records = []; foreach ($this->configFactory->loadMultiple($names) as $config) { diff --git a/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php b/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php index f5ff705..508f39b 100644 --- a/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php +++ b/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php @@ -581,20 +581,20 @@ public function testSaveNoMismatch() { $this->configFactory->expects($this->once()) ->method('get') ->with('the_config_prefix.baz') - ->willReturn($config_object); + ->will($this->returnValue($config_object)); $this->configFactory->expects($this->once()) ->method('rename') ->willReturn($this->configFactory); $this->configFactory->expects($this->exactly(1)) ->method('getEditable') ->with('the_config_prefix.foo') - ->willReturn($config_object); + ->will($this->returnValue($config_object)); $this->entityQuery->expects($this->once()) ->method('condition') ->will($this->returnSelf()); $this->entityQuery->expects($this->once()) ->method('execute') - ->willReturn(['baz']); + ->will($this->returnValue(array('baz'))); $entity = $this->getMockEntity(array('id' => 'foo')); $entity->setOriginalId('baz'); @@ -615,7 +615,7 @@ public function testSaveChangedUuid() { ->getMock(); $config_object->expects($this->atLeastOnce()) ->method('isNew') - ->willReturn(FALSE); + ->will($this->returnValue(FALSE)); $config_object->expects($this->never()) ->method('save'); $config_object->expects($this->exactly(2)) @@ -643,29 +643,29 @@ public function testSaveChangedUuid() { $this->configFactory->expects($this->at(1)) ->method('loadMultiple') ->with(array('the_config_prefix.foo')) - ->willReturn([]); + ->will($this->returnValue(array())); $this->configFactory->expects($this->at(2)) ->method('loadMultiple') ->with(array('the_config_prefix.foo')) - ->willReturn(array($config_object)); + ->will($this->returnValue(array($config_object))); $this->configFactory->expects($this->once()) ->method('get') ->with('the_config_prefix.foo') - ->willReturn($config_object); + ->will($this->returnValue($config_object)); $this->configFactory->expects($this->never()) ->method('rename') - ->willReturn($config_object); + ->will($this->returnValue($config_object)); $this->moduleHandler->expects($this->exactly(2)) ->method('getImplementations') - ->willReturn([]); + ->will($this->returnValue(array())); $this->entityQuery->expects($this->once()) ->method('condition') ->will($this->returnSelf()); $this->entityQuery->expects($this->once()) ->method('execute') - ->willReturn(['foo']); + ->will($this->returnValue(array('foo'))); $entity = $this->getMockEntity(array('id' => 'foo')); @@ -705,10 +705,10 @@ public function testLoad() { $this->configFactory->expects($this->once()) ->method('loadMultiple') ->with(array('the_config_prefix.foo')) - ->willReturn([$config_object]); + ->will($this->returnValue(array($config_object))); $this->moduleHandler->expects($this->exactly(2)) ->method('getImplementations') - ->willReturn([]); + ->will($this->returnValue(array())); $entity = $this->entityStorage->load('foo'); $this->assertInstanceOf('Drupal\Core\Entity\EntityInterface', $entity); @@ -769,14 +769,14 @@ public function testLoadMultipleAll() { $this->configFactory->expects($this->once()) ->method('listAll') ->with('the_config_prefix.') - ->willReturn(array('the_config_prefix.foo' , 'the_config_prefix.bar')); + ->will($this->returnValue(array('the_config_prefix.foo' , 'the_config_prefix.bar'))); $this->configFactory->expects($this->once()) ->method('loadMultiple') ->with(array('the_config_prefix.foo' , 'the_config_prefix.bar')) - ->willReturn(array($foo_config_object, $bar_config_object)); + ->will($this->returnValue(array($foo_config_object, $bar_config_object))); $this->moduleHandler->expects($this->exactly(2)) ->method('getImplementations') - ->willReturn([]); + ->will($this->returnValue(array())); $entities = $this->entityStorage->loadMultiple(); $expected['foo'] = 'foo'; @@ -820,10 +820,10 @@ public function testLoadMultipleIds() { $this->configFactory->expects($this->once()) ->method('loadMultiple') ->with(array('the_config_prefix.foo')) - ->willReturn(array($config_object)); + ->will($this->returnValue(array($config_object))); $this->moduleHandler->expects($this->exactly(2)) ->method('getImplementations') - ->willReturn([]); + ->will($this->returnValue(array())); $entities = $this->entityStorage->loadMultiple(array('foo')); foreach ($entities as $id => $entity) {