storage = $this->getMock('Drupal\Core\Config\StorageInterface'); $this->eventDispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface'); $this->typedConfig = $this->getMock('\Drupal\Core\Config\TypedConfigManagerInterface'); $this->configTranslation = new LanguageConfigOverride('config.test', $this->storage, $this->typedConfig, $this->eventDispatcher); $this->cacheTagsInvalidator = $this->getMock('Drupal\Core\Cache\CacheTagsInvalidatorInterface'); $container = new ContainerBuilder(); $container->set('cache_tags.invalidator', $this->cacheTagsInvalidator); \Drupal::setContainer($container); } /** * @covers ::save */ public function testSaveNew() { $this->cacheTagsInvalidator->expects($this->once()) ->method('invalidateTags') ->with(['config:config.test']); $this->assertTrue($this->configTranslation->isNew()); $this->configTranslation->save(); } /** * @covers ::save */ public function testSaveExisting() { $this->cacheTagsInvalidator->expects($this->once()) ->method('invalidateTags') ->with(['config:config.test']); $this->configTranslation->initWithData([]); $this->configTranslation->save(); } /** * @covers ::delete */ public function testDelete() { $this->cacheTagsInvalidator->expects($this->once()) ->method('invalidateTags') ->with(['config:config.test']); $this->configTranslation->initWithData([]); $this->configTranslation->delete(); } }