Update to Drupal 8.0.0-beta15. For more information, see: https://www.drupal.org/node/2563023

This commit is contained in:
Pantheon Automation 2015-09-04 13:20:09 -07:00 committed by Greg Anderson
parent 2720a9ec4b
commit f3791f1da3
1898 changed files with 54300 additions and 11481 deletions

View file

@ -13,7 +13,7 @@ use Drupal\migrate_drupal\Tests\d6\MigrateDrupal6TestBase;
/**
* Upgrade variables to update.settings.yml.
*
* @group update
* @group migrate_drupal_6
*/
class MigrateUpdateConfigsTest extends MigrateDrupal6TestBase {
@ -31,7 +31,6 @@ class MigrateUpdateConfigsTest extends MigrateDrupal6TestBase {
*/
protected function setUp() {
parent::setUp();
$this->loadDumps(['Variable.php']);
$this->executeMigration('d6_update_settings');
}

View file

@ -66,6 +66,7 @@ class UpdateContribTest extends UpdateTestBase {
* Tests the basic functionality of a contrib module on the status report.
*/
function testUpdateContribBasic() {
$project_link = \Drupal::l(t('AAA Update test'), Url::fromUri('http://example.com/project/aaa_update_test'));
$system_info = array(
'#all' => array(
'version' => '8.0.0',
@ -87,7 +88,30 @@ class UpdateContribTest extends UpdateTestBase {
$this->assertText(t('Up to date'));
$this->assertRaw('<h3>' . t('Modules') . '</h3>');
$this->assertNoText(t('Update available'));
$this->assertRaw(\Drupal::l(t('AAA Update test'), Url::fromUri('http://example.com/project/aaa_update_test')), 'Link to aaa_update_test project appears.');
$this->assertRaw($project_link, 'Link to aaa_update_test project appears.');
// Since aaa_update_test is installed the fact it is hidden and in the
// Testing package means it should not appear.
$system_info['aaa_update_test']['hidden'] = TRUE;
$this->config('update_test.settings')->set('system_info', $system_info)->save();
$this->refreshUpdateStatus(
array(
'drupal' => '0.0',
'aaa_update_test' => '1_0',
)
);
$this->assertNoRaw($project_link, 'Link to aaa_update_test project does not appear.');
// A hidden and installed project not in the Testing package should appear.
$system_info['aaa_update_test']['package'] = 'aaa_update_test';
$this->config('update_test.settings')->set('system_info', $system_info)->save();
$this->refreshUpdateStatus(
array(
'drupal' => '0.0',
'aaa_update_test' => '1_0',
)
);
$this->assertRaw($project_link, 'Link to aaa_update_test project appears.');
}
/**

View file

@ -22,12 +22,13 @@ class UpdateCoreTest extends UpdateTestBase {
*
* @var array
*/
public static $modules = array('update_test', 'update', 'language');
public static $modules = ['update_test', 'update', 'language', 'block'];
protected function setUp() {
parent::setUp();
$admin_user = $this->drupalCreateUser(array('administer site configuration', 'administer modules', 'administer themes'));
$this->drupalLogin($admin_user);
$this->drupalPlaceBlock('local_actions_block');
}
/**

View file

@ -21,6 +21,7 @@
namespace Drupal\update\Tests;
use Drupal\Core\DrupalKernel;
use Drupal\Core\Url;
use Drupal\simpletest\WebTestBase;
@ -29,6 +30,29 @@ use Drupal\simpletest\WebTestBase;
*/
abstract class UpdateTestBase extends WebTestBase {
protected function setUp() {
parent::setUp();
// Change the root path which Update Manager uses to install and update
// projects to be inside the testing site directory. See
// \Drupal\update\UpdateRootFactory::get() for equivalent changes to the
// test child site.
$request = \Drupal::request();
$update_root = $this->container->get('update.root') . '/' . DrupalKernel::findSitePath($request);
$this->container->set('update.root', $update_root);
\Drupal::setContainer($this->container);
// Create the directories within the root path within which the Update
// Manager will install projects.
foreach (drupal_get_updaters() as $updater_info) {
$updater = $updater_info['class'];
$install_directory = $update_root . '/' . $updater::getRootDirectoryRelativePath();
if (!is_dir($install_directory)) {
mkdir($install_directory);
}
}
}
/**
* Refreshes the update status based on the desired available update scenario.
*

View file

@ -7,6 +7,7 @@
namespace Drupal\update\Tests;
use Drupal\Core\Extension\InfoParserDynamic;
use Drupal\Core\Updater\Updater;
use Drupal\Core\Url;
@ -26,12 +27,12 @@ class UpdateUploadTest extends UpdateTestBase {
protected function setUp() {
parent::setUp();
$admin_user = $this->drupalCreateUser(array('administer software updates', 'administer site configuration'));
$admin_user = $this->drupalCreateUser(array('administer modules', 'administer software updates', 'administer site configuration'));
$this->drupalLogin($admin_user);
}
/**
* Tests upload and extraction of a module.
* Tests upload, extraction, and update of a module.
*/
public function testUploadModule() {
// Images are not valid archives, so get one and try to install it. We
@ -46,6 +47,7 @@ class UpdateUploadTest extends UpdateTestBase {
// This also checks that the correct archive extensions are allowed.
$this->drupalPostForm('admin/modules/install', $edit, t('Install'));
$this->assertText(t('Only files with the following extensions are allowed: @archive_extensions.', array('@archive_extensions' => archiver_get_extensions())),'Only valid archives can be uploaded.');
$this->assertUrl('admin/modules/install');
// Check to ensure an existing module can't be reinstalled. Also checks that
// the archive was extracted since we can't know if the module is already
@ -56,6 +58,74 @@ class UpdateUploadTest extends UpdateTestBase {
);
$this->drupalPostForm('admin/modules/install', $edit, t('Install'));
$this->assertText(t('@module_name is already installed.', array('@module_name' => 'AAA Update test')), 'Existing module was extracted and not reinstalled.');
$this->assertUrl('admin/modules/install');
// Ensure that a new module can be extracted and installed.
$updaters = drupal_get_updaters();
$moduleUpdater = $updaters['module']['class'];
$installedInfoFilePath = $this->container->get('update.root') . '/' . $moduleUpdater::getRootDirectoryRelativePath() . '/update_test_new_module/update_test_new_module.info.yml';
$this->assertFalse(file_exists($installedInfoFilePath), 'The new module does not exist in the filesystem before it is installed with the Update Manager.');
$validArchiveFile = drupal_get_path('module', 'update') . '/tests/update_test_new_module/8.x-1.0/update_test_new_module.tar.gz';
$edit = array(
'files[project_upload]' => $validArchiveFile,
);
$this->drupalPostForm('admin/modules/install', $edit, t('Install'));
// Check that submitting the form takes the user to authorize.php.
$this->assertUrl('core/authorize.php');
$this->assertTitle('Update manager | Drupal');
// Check for a success message on the page, and check that the installed
// module now exists in the expected place in the filesystem.
$this->assertRaw(t('Installed %project_name successfully', array('%project_name' => 'update_test_new_module')));
$this->assertTrue(file_exists($installedInfoFilePath), 'The new module exists in the filesystem after it is installed with the Update Manager.');
// Ensure the links are relative to the site root and not
// core/authorize.php.
$this->assertLink(t('Install another module'));
$this->assertLinkByHref(Url::fromRoute('update.module_install')->toString());
$this->assertLink(t('Enable newly added modules'));
$this->assertLinkByHref(Url::fromRoute('system.modules_list')->toString());
$this->assertLink(t('Administration pages'));
$this->assertLinkByHref(Url::fromRoute('system.admin')->toString());
// Ensure we can reach the "Install another module" link.
$this->clickLink(t('Install another module'));
$this->assertResponse(200);
$this->assertUrl('admin/modules/install');
// Check that the module has the correct version before trying to update
// it. Since the module is installed in sites/simpletest, which only the
// child site has access to, standard module API functions won't find it
// when called here. To get the version, the info file must be parsed
// directly instead.
$info_parser = new InfoParserDynamic();
$info = $info_parser->parse($installedInfoFilePath);
$this->assertEqual($info['version'], '8.x-1.0');
// Enable the module.
$this->drupalPostForm('admin/modules', array('modules[Testing][update_test_new_module][enable]' => TRUE), t('Install'));
// Define the update XML such that the new module downloaded above needs an
// update from 8.x-1.0 to 8.x-1.1.
$update_test_config = $this->config('update_test.settings');
$system_info = array(
'update_test_new_module' => array(
'project' => 'update_test_new_module',
),
);
$update_test_config->set('system_info', $system_info)->save();
$xml_mapping = array(
'update_test_new_module' => '1_1',
);
$this->refreshUpdateStatus($xml_mapping);
// Run the updates for the new module.
$this->drupalPostForm('admin/reports/updates/update', array('projects[update_test_new_module]' => TRUE), t('Download these updates'));
$this->drupalPostForm(NULL, array('maintenance_mode' => FALSE), t('Continue'));
$this->assertText(t('Update was completed successfully.'));
$this->assertRaw(t('Installed %project_name successfully', array('%project_name' => 'update_test_new_module')));
// Parse the info file again to check that the module has been updated to
// 8.x-1.1.
$info = $info_parser->parse($installedInfoFilePath);
$this->assertEqual($info['version'], '8.x-1.1');
}
/**