function TarTest::testCreateArchive
Tests that the Tar archive is created if it does not exist.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Archiver/ TarTest.php, line 29
Class
- TarTest
- Tests Drupal\Core\Archiver\Tar.
Namespace
Drupal\KernelTests\Core\ArchiverCode
public function testCreateArchive() : void {
$this->expectDeprecation('\\Drupal\\Core\\Archiver\\Tar is deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. There is no replacement. See https://www.drupal.org/node/3556927');
$textFile = current($this->getTestFiles('text'));
$archiveFilename = $this->fileSystem
->realpath('public://' . $this->randomMachineName() . '.tar');
$tar = new Tar($archiveFilename);
$tar->add($this->fileSystem
->realPath($textFile->uri));
$this->assertFileExists($archiveFilename, 'Archive is automatically created if the file does not exist.');
$this->assertArchiveContainsFile($archiveFilename, $this->fileSystem
->realPath($textFile->uri));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.