Skip to content
Snippets Groups Projects
Commit bbcb57c2 authored by Luke Leber's avatar Luke Leber
Browse files

Enable module by default for users of RC1 and RC2.

parent 6f6279fd
No related branches found
No related tags found
No related merge requests found
<?php
/**
* @file
* Contains post update functions for Inline All CSS.
*/
/**
* Ensure that module behavior does not change from the RC2 release.
*/
function inline_all_css_post_update_retain_rc2_state() {
\Drupal::configFactory()
->getEditable('inline_all_css.settings')
->set('enabled', TRUE)
->save();
}
<?php
/**
* @file
* Sets up the database state for the upgrade path tests.
*/
use Drupal\Core\Database\Database;
$connection = Database::getConnection();
// Set the schema version.
$connection->merge('key_value')
->condition('collection', 'system.schema')
->condition('name', 'inline_all_css')
->fields([
'collection' => 'system.schema',
'name' => 'inline_all_css',
'value' => 's:4:"9000";',
])
->execute();
// Add the proper core.extension configuration.
$extensions = $connection->select('config')
->fields('config', ['data'])
->condition('collection', '')
->condition('name', 'core.extension')
->execute()
->fetchField();
$extensions = unserialize($extensions, ['allowed_classes' => []]);
$extensions['module']['inline_all_css'] = 9000;
$connection->update('config')
->fields([
'data' => serialize($extensions),
])
->condition('collection', '')
->condition('name', 'core.extension')
->execute();
<?php
namespace Drupal\Tests\inline_all_css\Functional;
use Drupal\FunctionalTests\Update\UpdatePathTestBase;
/**
* Test cases for the incremental upgrade path.
*
* @group inline_all_css
*/
class PostUpdateTest extends UpdatePathTestBase {
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* The config factory service.
*
* @var \Drupal\Core\Config\ConfigFactoryInterface
*/
protected $configFactory;
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->configFactory = $this->container->get('config.factory');
}
/**
* {@inheritdoc}
*/
protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [
DRUPAL_ROOT . '/core/modules/system/tests/fixtures/update/drupal-9.0.0.bare.standard.php.gz',
__DIR__ . '/../../fixtures/update/inline_all_css.update-hook-test.php',
];
}
/**
* {@inheritdoc}
*/
protected function doSelectionTest() {
parent::doSelectionTest();
$this->assertSession()->responseContains('Ensure that module behavior does not change from the RC2 release.');
}
/**
* Test case for the upgrade path.
*/
public function testUpgrade() {
static::assertArrayNotHasKey('inline_all_css.settings', $this->configFactory->listAll());
$this->runUpdates();
static::assertTrue($this->config('inline_all_css.settings')->get('enabled'));
}
}
......@@ -173,9 +173,6 @@ CSS
/**
* Sets up the CSS to add in the dispatched event.
*
* @param string $css
* The CSS to add.
*/
protected function setEventCss() {
$this->eventDispatcher->method('dispatch')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment