3 namespace Drupal\Tests\update\Functional;
6 * Tests the Update Manager module upload via authorize.php functionality.
10 class FileTransferAuthorizeFormTest extends UpdateTestBase {
17 public static $modules = ['update', 'update_test'];
19 protected function setUp() {
21 $admin_user = $this->drupalCreateUser(['administer modules', 'administer software updates', 'administer site configuration']);
22 $this->drupalLogin($admin_user);
24 // Create a local cache so the module is not downloaded from drupal.org.
25 $cache_directory = _update_manager_cache_directory(TRUE);
26 $validArchiveFile = __DIR__ . '/../../update_test_new_module/8.x-1.0/update_test_new_module.tar.gz';
27 copy($validArchiveFile, $cache_directory . '/update_test_new_module.tar.gz');
31 * Tests the Update Manager module upload via authorize.php functionality.
33 public function testViaAuthorize() {
34 // Ensure the that we can select which file transfer backend to use.
35 \Drupal::state()->set('test_uploaders_via_prompt', TRUE);
37 // Ensure the module does not already exist.
38 $this->drupalGet('admin/modules');
39 $this->assertNoText('Update test new module');
42 // This project has been cached in the test's setUp() method.
43 'project_url' => 'https://ftp.drupal.org/files/projects/update_test_new_module.tar.gz',
45 $this->drupalPostForm('admin/modules/install', $edit, t('Install'));
47 'connection_settings[authorize_filetransfer_default]' => 'system_test',
48 'connection_settings[system_test][update_test_username]' => $this->randomMachineName(),
50 $this->drupalPostForm(NULL, $edit, t('Continue'));
51 $this->assertText(t('Installation was completed successfully.'));
53 // Ensure the module is available to install.
54 $this->drupalGet('admin/modules');
55 $this->assertText('Update test new module');