You are here

protected function ConfigInstallerTestBase::extractTarball in Configuration installer 8

Extracts a tarball to a directory.

Parameters

string $tarball_path: The path to a tarball to extract.

string $directory: The directory to extract to.

Return value

string[] The list files extracted.

2 calls to ConfigInstallerTestBase::extractTarball()
ConfigInstallerFrDirectorySyncTest::setUpSyncForm in tests/src/Functional/ConfigInstallerFrDirectorySyncTest.php
Submit the config_installer_sync_configure_form.
ConfigInstallerSyncTest::setUpSyncForm in tests/src/Functional/ConfigInstallerSyncTest.php
Submit the config_installer_sync_configure_form.

File

tests/src/Functional/ConfigInstallerTestBase.php, line 164

Class

ConfigInstallerTestBase
Provides functionality for testing the config_installer profile.

Namespace

Drupal\Tests\config_installer\Functional

Code

protected function extractTarball($tarball_path, $directory) {
  $archiver = new ArchiveTar($tarball_path, 'gz');
  $files = [];
  $list = $archiver
    ->listContent();
  if (is_array($list)) {

    /** @var array $list */
    foreach ($list as $file) {
      $files[] = $file['filename'];
    }
  }
  $archiver
    ->extractList($files, $directory);
  return $files;
}