You are here

public function FileTransferAuthorizeFormTest::testViaAuthorize in Drupal 9

Same name and namespace in other branches
  1. 8 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
    ->assertSession()
    ->pageTextNotContains('Update test new module');
  $edit = [
    'project_url' => $url,
  ];
  $this
    ->drupalGet('admin/modules/install');
  $this
    ->submitForm($edit, 'Continue');
  $edit = [
    'connection_settings[authorize_filetransfer_default]' => 'system_test',
    'connection_settings[system_test][update_test_username]' => $this
      ->randomMachineName(),
  ];
  $this
    ->submitForm($edit, 'Continue');
  $this
    ->assertSession()
    ->pageTextContains('Files were added successfully.');

  // Ensure the module is available to install.
  $this
    ->drupalGet('admin/modules');
  $this
    ->assertSession()
    ->pageTextContains('Update test new module');
}