WarmCacheUpdateFrom8dot6Test.php in Drupal 8
File
core/modules/system/tests/src/Functional/Update/WarmCacheUpdateFrom8dot6Test.php
View source
<?php
namespace Drupal\Tests\system\Functional\Update;
use Drupal\Core\Database\Database;
use Drupal\FunctionalTests\Update\UpdatePathTestBase;
use Symfony\Component\DependencyInjection\ContainerInterface;
class WarmCacheUpdateFrom8dot6Test extends UpdatePathTestBase {
protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles[0] = __DIR__ . '/../../../../tests/fixtures/update/drupal-8.6.0-minimal-with-warm-caches.sql.gz';
$this->databaseDumpFiles[1] = __DIR__ . '/../../../../tests/fixtures/update/drupal-8.test-config-init.php';
}
public function testUpdatedSite() {
$row_count = Database::getConnection()
->select('key_value')
->condition('collection', 'state')
->condition('name', 'system.theme.data')
->countQuery()
->execute()
->fetchField();
$this
->assertSame('1', $row_count, 'The system.theme.data key exists in state.');
$this
->runUpdates();
$this
->drupalGet('');
$this
->assertSame('test_mail_collector', $this
->config('system.mail')
->get('interface.default'));
$this
->assertSame('verbose', $this
->config('system.logging')
->get('error_level'));
$this
->assertSame(FALSE, $this
->config('system.performance')
->get('css.preprocess'));
$this
->assertSame(FALSE, $this
->config('system.performance')
->get('js.preprocess'));
$this
->assertSame('Australia/Sydney', $this
->config('system.date')
->get('timezone.default'));
$this
->assertNull(\Drupal::state()
->get('system.theme.data'), 'The system.theme.data key does not exist in state.');
}
public function testWithMissingProfile() {
$connection = Database::getConnection();
$config = $connection
->select('config')
->fields('config', [
'data',
])
->condition('collection', '')
->condition('name', 'core.extension')
->execute()
->fetchField();
$config = unserialize($config);
unset($config['module']['minimal']);
$connection
->update('config')
->fields([
'data' => serialize($config),
'collection' => '',
'name' => 'core.extension',
])
->condition('collection', '')
->condition('name', 'core.extension')
->execute();
$this
->runUpdates();
$this
->assertSession()
->pageTextContains('The minimal install profile has been added to the installed module list.');
$this
->drupalLogin($this->rootUser);
$this
->drupalGet('admin/reports/status');
$this
->assertSession()
->pageTextContains("Installation Profile Minimal");
}
protected function initConfig(ContainerInterface $container) {
}
}