_update_manager_cache_directory example


  protected function setUp(): void {
    parent::setUp();
    $admin_user = $this->drupalCreateUser([
      'administer modules',
      'administer software updates',
    ]);
    $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
      );
    }
  }

  /** * Tests the Update Manager module upload via authorize.php functionality. * * @dataProvider archiveFileUrlProvider */
$this->cronRun();
    $this->drupalGet('admin/modules');
    $this->assertSession()->pageTextNotContains('No update information available.');
  }

  /** * Checks that clearing the disk cache works. */
  public function testClearDiskCache() {
    $directories = [
      _update_manager_cache_directory(FALSE),
      _update_manager_extract_directory(FALSE),
    ];
    // Check that update directories does not exists.     foreach ($directories as $directory) {
      $this->assertDirectoryDoesNotExist($directory);
    }

    // Method must not fail if update directories do not exists.     update_clear_update_disk_cache();
  }

  
Home | Imprint | This part of the site doesn't use cookies.