
| Current Path : /var/www/html/stolberg/web/core/tests/Drupal/KernelTests/Core/Archiver/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/stolberg/web/core/tests/Drupal/KernelTests/Core/Archiver/TarTest.php |
<?php
declare(strict_types=1);
namespace Drupal\KernelTests\Core\Archiver;
use Drupal\Core\Archiver\Tar;
/**
* @coversDefaultClass \Drupal\Core\Archiver\Tar
* @group tar
*/
class TarTest extends ArchiverTestBase {
/**
* {@inheritdoc}
*/
protected $archiverPluginId = 'Tar';
/**
* Tests that the Tar archive is created if it does not exist.
*/
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));
}
}