ViewsConfigUpdaterTest.php
Same filename in this branch
Same filename and directory in other branches
Namespace
Drupal\Tests\views\FunctionalFile
-
core/
modules/ views/ tests/ src/ Functional/ ViewsConfigUpdaterTest.php
View source
<?php
declare (strict_types=1);
namespace Drupal\Tests\views\Functional;
use Drupal\Core\Database\Database;
use Drupal\Tests\BrowserTestBase;
use Drupal\Tests\UpdatePathTestTrait;
/**
* Tests the views config updater service.
*
* @group views
*/
class ViewsConfigUpdaterTest extends BrowserTestBase {
use UpdatePathTestTrait;
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* {@inheritdoc}
*/
protected static $modules = [
'views',
];
/**
* {@inheritdoc}
*/
protected function setUp() : void {
parent::setUp();
$connection = Database::getConnection();
// Enable views_test_config_updater via the database so post_update hooks
// can run.
$extensions = $connection->select('config')
->fields('config', [
'data',
])
->condition('collection', '')
->condition('name', 'core.extension')
->execute()
->fetchField();
$extensions = unserialize($extensions);
$extensions['module']['views_test_config_updater'] = 0;
$connection->update('config')
->fields([
'data' => serialize($extensions),
])
->condition('collection', '')
->condition('name', 'core.extension')
->execute();
}
/**
* Tests the deprecationsEnabled flag persists from post_update to presave.
*
* @see views_test_config_updater_post_update_set_deprecations_disabled
* @see \Drupal\views_test_config_updater\Hook\ViewsTestConfigUpdaterHooks::viewPresave()
*/
public function testDeprecationsFlagPersists() : void {
$this->assertNull(\Drupal::keyValue('views_test_config_updater')->get('deprecations_enabled'));
$this->runUpdates();
$this->assertFalse(\Drupal::keyValue('views_test_config_updater')->get('deprecations_enabled'));
}
}
Classes
Title | Deprecated | Summary |
---|---|---|
ViewsConfigUpdaterTest | Tests the views config updater service. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.