function TarTest::testCreateArchive
Same name in other branches
- 10 core/tests/Drupal/KernelTests/Core/Archiver/TarTest.php \Drupal\KernelTests\Core\Archiver\TarTest::testCreateArchive()
Tests that the Tar archive is created if it does not exist.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Archiver/ TarTest.php, line 22
Class
- TarTest
- @coversDefaultClass \Drupal\Core\Archiver\Tar @group tar
Namespace
Drupal\KernelTests\Core\ArchiverCode
public function testCreateArchive() : void {
$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.