You are here

protected function FileTransferAuthorizeFormTest::setUp 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::setUp()

Overrides UpdateTestBase::setUp

File

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

Class

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

Namespace

Drupal\Tests\update\Functional

Code

protected function setUp() : void {
  parent::setUp();
  $admin_user = $this
    ->drupalCreateUser([
    '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);
  foreach ([
    '.tar.gz',
    '.zip',
  ] as $extension) {
    $filename = 'update_test_new_module' . $extension;
    copy(__DIR__ . '/../../update_test_new_module/8.x-1.0/' . $filename, $cache_directory . '/' . $filename);
  }
}