3 namespace Drupal\Tests\views\Functional\Update;
5 use Drupal\FunctionalTests\Update\UpdatePathTestBase;
6 use Drupal\views\Entity\View;
9 * Tests Views image style dependencies update.
14 class ImageStyleDependencyUpdateTest extends UpdatePathTestBase {
19 protected function setDatabaseDumpFiles() {
20 $this->databaseDumpFiles = [
21 __DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8-rc1.bare.standard.php.gz',
22 __DIR__ . '/../../../../../system/tests/fixtures/update/drupal8.views-image-style-dependency-2649914.php',
27 * Tests the updating of views dependencies to image styles.
29 public function testUpdateImageStyleDependencies() {
30 $config_dependencies = View::load('foo')->getDependencies()['config'];
32 // Checks that 'thumbnail' image style is not a dependency of view 'foo'.
33 $this->assertFalse(in_array('image.style.thumbnail', $config_dependencies));
35 // We test the case the the field formatter image style doesn't exist.
36 // Checks that 'nonexistent' image style is not a dependency of view 'foo'.
37 $this->assertFalse(in_array('image.style.nonexistent', $config_dependencies));
42 $config_dependencies = View::load('foo')->getDependencies()['config'];
44 // Checks that 'thumbnail' image style is a dependency of view 'foo'.
45 $this->assertTrue(in_array('image.style.thumbnail', $config_dependencies));
47 // The 'nonexistent' style doesn't exist, thus is not a dependency. Checks
48 // that 'nonexistent' image style is a not dependency of view 'foo'.
49 $this->assertFalse(in_array('image.style.nonexistent', $config_dependencies));