diff --git a/core/modules/update/src/Tests/UpdateViaAuthorizeTest.php b/core/modules/update/src/Tests/UpdateViaAuthorizeTest.php index 7f7fe6e..cffb786 100644 --- a/core/modules/update/src/Tests/UpdateViaAuthorizeTest.php +++ b/core/modules/update/src/Tests/UpdateViaAuthorizeTest.php @@ -20,6 +20,11 @@ protected function setUp() { parent::setUp(); $admin_user = $this->drupalCreateUser(array('administer modules', 'administer software updates', 'administer site configuration')); $this->drupalLogin($admin_user); + + // Create a local cache so the module is not downloaded from drupal.org. + $cache_directory = _update_manager_cache_directory(TRUE); + $validArchiveFile = __DIR__ . '/../../tests/update_test_new_module/8.x-1.0/update_test_new_module.tar.gz'; + copy($validArchiveFile, $cache_directory . '/update_test_new_module.tar.gz'); } /** @@ -29,16 +34,25 @@ public function testViaAuthorize() { // Ensure the that we can select which file transfer backend to use. \Drupal::state()->set('test_uploaders_via_prompt', TRUE); + // Ensure the module does not already exist. + $this->drupalGet('admin/modules'); + $this->assertNoText('Update test new module'); + $edit = [ - 'project_url' => 'https://ftp.drupal.org/files/projects/config_inspector-8.x-1.0-beta1.tar.gz', + // This project has been cached in the test's setUp() method. + 'project_url' => 'https://ftp.drupal.org/files/projects/update_test_new_module.tar.gz', ]; - $this->drupalPostForm('http://drupal8alt.dev/admin/modules/install', $edit, t('Install')); + $this->drupalPostForm('admin/modules/install', $edit, t('Install')); $edit = [ 'connection_settings[authorize_filetransfer_default]' => 'system_test', 'connection_settings[system_test][update_test_username]' => $this->randomMachineName(), ]; $this->drupalPostForm(NULL, $edit, t('Continue')); $this->assertText(t('Installation was completed successfully.')); + + // Ensure the module is available to install. + $this->drupalGet('admin/modules'); + $this->assertText('Update test new module'); } }