Issue #2989469 by amateescu: MediaUpdateTest is broken
parent
9077b0e47a
commit
bfb517693e
File diff suppressed because one or more lines are too long
36
core/modules/media/tests/fixtures/update/drupal-8.media-add-additional-permissions.php
vendored
Normal file
36
core/modules/media/tests/fixtures/update/drupal-8.media-add-additional-permissions.php
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
<?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();
|
File diff suppressed because one or more lines are too long
|
@ -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 @@ class MediaUpdateTest extends UpdatePathTestBase {
|
|||
* @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 @@ class MediaUpdateTest extends UpdatePathTestBase {
|
|||
* @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'));
|
||||
|
|
Loading…
Reference in New Issue