diff --git a/core/modules/content_translation/tests/src/Unit/Access/ContentTranslationManageAccessCheckTest.php b/core/modules/content_translation/tests/src/Unit/Access/ContentTranslationManageAccessCheckTest.php index 512e735..6c95f7e 100644 --- a/core/modules/content_translation/tests/src/Unit/Access/ContentTranslationManageAccessCheckTest.php +++ b/core/modules/content_translation/tests/src/Unit/Access/ContentTranslationManageAccessCheckTest.php @@ -9,6 +9,7 @@ use Drupal\content_translation\Access\ContentTranslationManageAccessCheck; use Drupal\Core\Access\AccessResult; +use Drupal\Core\DependencyInjection\ContainerBuilder; use Drupal\Core\Language\Language; use Drupal\Tests\UnitTestCase; use Symfony\Component\Routing\Route; @@ -23,6 +24,28 @@ class ContentTranslationManageAccessCheckTest extends UnitTestCase { /** + * The cache contexts manager. + * + * @var \Drupal\Core\Cache\Context\CacheContextsManager|\PHPUnit_Framework_MockObject_MockObject + */ + protected $cacheContextsManager; + + /** + * {@inheritdoc} + */ + protected function setUp() { + parent::setUp(); + + $this->cacheContextsManager = $this->getMockBuilder('Drupal\Core\Cache\Context\CacheContextsManager') + ->disableOriginalConstructor() + ->getMock(); + + $container = new ContainerBuilder(); + $container->set('cache_contexts_manager', $this->cacheContextsManager); + \Drupal::setContainer($container); + } + + /** * Tests the create access method. * * @covers ::access @@ -76,6 +99,9 @@ public function testCreateAccess() { $entity->expects($this->once()) ->method('getCacheTags') ->will($this->returnValue(array('node:1337'))); + $entity->expects($this->once()) + ->method('getCacheContexts') + ->willReturn(array()); // Set the route requirements. $route = new Route('test_route'); diff --git a/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php b/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php index 508f39b..8033a8c 100644 --- a/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php +++ b/core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityStorageTest.php @@ -627,7 +627,7 @@ public function testSaveChangedUuid() { $config_object->expects($this->exactly(1)) ->method('getCacheContexts') ->willReturn([]); - $config_object->expects($this->exactly(1)) + $config_object->expects($this->exactly(2)) ->method('getCacheTags') ->willReturn(['config:foo']); $config_object->expects($this->exactly(1))