function FileTransferAuthorizeFormTest::testViaAuthorize

Same name and namespace in other branches
  1. 9 core/modules/update/tests/src/Functional/FileTransferAuthorizeFormTest.php \Drupal\Tests\update\Functional\FileTransferAuthorizeFormTest::testViaAuthorize()
  2. 8.9.x core/modules/update/tests/src/Functional/FileTransferAuthorizeFormTest.php \Drupal\Tests\update\Functional\FileTransferAuthorizeFormTest::testViaAuthorize()
  3. 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 46

Class

FileTransferAuthorizeFormTest
Tests the Update Manager module upload via <a href="/api/drupal/core%21authorize.php/11.x" title="Administrative script for running authorized file operations." class="local">authorize.php</a> functionality.

Namespace

Drupal\Tests\update\Functional

Code

public function testViaAuthorize($url) : void {
    // 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');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.