X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=web%2Fcore%2Fmodules%2Fviews%2Ftests%2Fsrc%2FFunctional%2FUpdate%2FImageStyleDependencyUpdateTest.php;fp=web%2Fcore%2Fmodules%2Fviews%2Ftests%2Fsrc%2FFunctional%2FUpdate%2FImageStyleDependencyUpdateTest.php;h=e183adedc125e11cf97c1dfbc9238a6bb9b2a1cb;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hp=0000000000000000000000000000000000000000;hpb=aea91e65e895364e460983b890e295aa5d5540a5;p=yaffs-website diff --git a/web/core/modules/views/tests/src/Functional/Update/ImageStyleDependencyUpdateTest.php b/web/core/modules/views/tests/src/Functional/Update/ImageStyleDependencyUpdateTest.php new file mode 100644 index 000000000..e183adedc --- /dev/null +++ b/web/core/modules/views/tests/src/Functional/Update/ImageStyleDependencyUpdateTest.php @@ -0,0 +1,51 @@ +databaseDumpFiles = [ + __DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8-rc1.bare.standard.php.gz', + __DIR__ . '/../../../../../system/tests/fixtures/update/drupal8.views-image-style-dependency-2649914.php', + ]; + } + + /** + * Tests the updating of views dependencies to image styles. + */ + public function testUpdateImageStyleDependencies() { + $config_dependencies = View::load('foo')->getDependencies()['config']; + + // Checks that 'thumbnail' image style is not a dependency of view 'foo'. + $this->assertFalse(in_array('image.style.thumbnail', $config_dependencies)); + + // We test the case the the field formatter image style doesn't exist. + // Checks that 'nonexistent' image style is not a dependency of view 'foo'. + $this->assertFalse(in_array('image.style.nonexistent', $config_dependencies)); + + // Run updates. + $this->runUpdates(); + + $config_dependencies = View::load('foo')->getDependencies()['config']; + + // Checks that 'thumbnail' image style is a dependency of view 'foo'. + $this->assertTrue(in_array('image.style.thumbnail', $config_dependencies)); + + // The 'nonexistent' style doesn't exist, thus is not a dependency. Checks + // that 'nonexistent' image style is a not dependency of view 'foo'. + $this->assertFalse(in_array('image.style.nonexistent', $config_dependencies)); + } + +}