Unverified Commit bfb51769 authored by alexpott's avatar alexpott

Issue #2989469 by amateescu: MediaUpdateTest is broken

parent 9077b0e4
This source diff could not be displayed because it is too large. You can view the blob instead.
<?php
// @codingStandardsIgnoreFile
/**
* @file
* Contains database additions to drupal-8.4.0.bare.standard.php.gz for testing
* the upgrade path of https://www.drupal.org/node/2862422.
*/
use Drupal\Core\Database\Database;
$connection = Database::getConnection();
$role = $connection->select('config')
->fields('config', ['data'])
->condition('collection', '')
->condition('name', 'user.role.authenticated')
->execute()
->fetchField();
$role = unserialize($role);
$role['permissions'][] = 'update media';
$role['permissions'][] = 'update any media';
$role['permissions'][] = 'delete media';
$role['permissions'][] = 'delete any media';
$role['permissions'][] = 'create media';
$connection->update('config')
->fields([
'data' => serialize($role),
'collection' => '',
'name' => 'user.role.authenticated',
])
->condition('collection', '')
->condition('name', 'user.role.authenticated')
->execute();
......@@ -18,8 +18,9 @@ class MediaUpdateTest extends UpdatePathTestBase {
*/
protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [
__DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.bare.standard.php.gz',
__DIR__ . '/../../../fixtures/update/drupal-8.media-enabled.php',
__DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.4.0.bare.standard.php.gz',
__DIR__ . '/../../../fixtures/update/drupal-8.4.0-media_installed.php',
__DIR__ . '/../../../fixtures/update/drupal-8.media-add-additional-permissions.php',
];
}
......@@ -29,16 +30,6 @@ protected function setDatabaseDumpFiles() {
* @see media_update_8500()
*/
public function testBundlePermission() {
$role = Role::load(Role::AUTHENTICATED_ID);
$this->grantPermissions($role, [
'update media',
'update any media',
'delete media',
'delete any media',
'create media',
]);
$this->runUpdates();
/** @var \Drupal\user\RoleInterface $role */
......@@ -60,16 +51,12 @@ public function testBundlePermission() {
* @see media_update_8600()
*/
public function testOEmbedConfig() {
// The drupal-8.media-enabled.php fixture installs Media and all its config,
// which includes the oembed_providers_url and iframe_domain keys in
// media.settings. So, in order to prove that the update actually works,
// delete the values from config before running the update.
$this->config('media.settings')
->clear('oembed_providers_url')
->clear('iframe_domain')
->save(TRUE);
$config = $this->config('media.settings');
$this->assertNull($config->get('oembed_providers_url'));
$this->assertNull($config->get('iframe_domain'));
$this->runUpdates();
$config = $this->config('media.settings');
$this->assertSame('https://oembed.com/providers.json', $config->get('oembed_providers_url'));
$this->assertSame('', $config->get('iframe_domain'));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment