function LegacyFunctionsTest::testArchiverGetArchiver

@expectedDeprecation archiver_get_archiver() is deprecated in Drupal 8.8.0 and will be removed in Drupal 9.0.x. Instead, get plugin.manager.archiver service from container and call getInstance() method on it. For example $archiver->getInstance(["filepath" => $file]); See https://www.drupal.org/node/2999951

File

core/tests/Drupal/KernelTests/Core/Common/LegacyFunctionsTest.php, line 45

Class

LegacyFunctionsTest
Tests legacy functions in common.inc.

Namespace

Drupal\KernelTests\Core\Common

Code

public function testArchiverGetArchiver() {
    $file = $this->root . '/core/modules/update/tests/aaa_update_test.tar.gz';
    $expected = \Drupal::service('plugin.manager.archiver')->getInstance([
        'filepath' => $file,
    ]);
    $actual = archiver_get_archiver($file);
    $this->assertEquals($expected, $actual);
}

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