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