function ImageUpdateTest::testPostUpdateImageStylesDependencies

Tests image_post_update_image_style_dependencies().

See also

image_post_update_image_style_dependencies()

File

core/modules/image/tests/src/Functional/Update/ImageUpdateTest.php, line 29

Class

ImageUpdateTest
Tests Image update path.

Namespace

Drupal\Tests\image\Functional\Update

Code

public function testPostUpdateImageStylesDependencies() {
    $view = 'core.entity_view_display.node.article.default';
    $form = 'core.entity_form_display.node.article.default';
    // Check that view display 'node.article.default' doesn't depend on image
    // style 'image.style.large'.
    $dependencies = $this->config($view)
        ->get('dependencies.config');
    $this->assertFalse(in_array('image.style.large', $dependencies));
    // Check that form display 'node.article.default' doesn't depend on image
    // style 'image.style.thumbnail'.
    $dependencies = $this->config($form)
        ->get('dependencies.config');
    $this->assertFalse(in_array('image.style.thumbnail', $dependencies));
    // Run updates.
    $this->runUpdates();
    // Check that view display 'node.article.default' depend on image style
    // 'image.style.large'.
    $dependencies = $this->config($view)
        ->get('dependencies.config');
    $this->assertTrue(in_array('image.style.large', $dependencies));
    // Check that form display 'node.article.default' depend on image style
    // 'image.style.thumbnail'.
    $dependencies = $this->config($view)
        ->get('dependencies.config');
    $this->assertTrue(in_array('image.style.large', $dependencies));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.