/** * Assert the behavior of the formatter dependencies. * * @param array $formatter_settings * The formatter settings to apply to the entity dispaly. */ protected function assertFormatterDependencyBehavior($formatter_settings) { // Assert the image style becomes a dependency of the entity display. $this->loadEntityDisplay()->setComponent($this->fieldName, $formatter_settings)->save(); $this->assertTrue(in_array('image.style.' . $this->style->id(), $this->loadEntityDisplay()->getDependencies()['config']), 'The image style was correctly added as a dependency the entity display config object.'); // Delete the image style. $storage = $this->entityTypeManager->getStorage('image_style'); $storage->setReplacementId($this->style->id(), $this->replacementStyle->id()); $this->style->delete(); // Ensure the replacement is now a dependency. $this->assertTrue(in_array('image.style.' . $this->replacementStyle->id(), $this->loadEntityDisplay()->getDependencies()['config']), 'The replacement style was added to the entity display.'); }