You are here

public function FileTransferAuthorizeFormTest::testViaAuthorize in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/update/tests/src/Functional/FileTransferAuthorizeFormTest.php \Drupal\Tests\update\Functional\FileTransferAuthorizeFormTest::testViaAuthorize()
  2. 10 core/modules/update/tests/src/Functional/FileTransferAuthorizeFormTest.php \Drupal\Tests\update\Functional\FileTransferAuthorizeFormTest::testViaAuthorize()

Tests the Update Manager module upload via authorize.php functionality.

@dataProvider archiveFileUrlProvider

File

core/modules/update/tests/src/Functional/FileTransferAuthorizeFormTest.php, line 49

Class

FileTransferAuthorizeFormTest
Tests the Update Manager module upload via authorize.php functionality.

Namespace

Drupal\Tests\update\Functional

Code

public function testViaAuthorize($url) {

  // 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' => $url,
  ];
  $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');
}