ImageStyleDependencyUpdateTest.php in Drupal 8
File
core/modules/views/tests/src/Functional/Update/ImageStyleDependencyUpdateTest.php
View source
<?php
namespace Drupal\Tests\views\Functional\Update;
use Drupal\FunctionalTests\Update\UpdatePathTestBase;
use Drupal\views\Entity\View;
class ImageStyleDependencyUpdateTest extends UpdatePathTestBase {
protected function setDatabaseDumpFiles() {
$this->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',
];
}
public function testUpdateImageStyleDependencies() {
$config_dependencies = View::load('foo')
->getDependencies()['config'];
$this
->assertFalse(in_array('image.style.thumbnail', $config_dependencies));
$this
->assertFalse(in_array('image.style.nonexistent', $config_dependencies));
$this
->runUpdates();
$config_dependencies = View::load('foo')
->getDependencies()['config'];
$this
->assertTrue(in_array('image.style.thumbnail', $config_dependencies));
$this
->assertFalse(in_array('image.style.nonexistent', $config_dependencies));
}
}