TimeTrex/vendor/pear/archive_tar/tests/longsymlinks.phpt

30 lines
952 B
Plaintext
Raw Normal View History

2022-12-13 07:10:06 +01:00
--TEST--
test trimming of characters in long symbolic link targets
--SKIPIF--
--FILE--
<?php
require_once dirname(__FILE__) . '/setup.php.inc';
$dirname = dirname(__FILE__) . '/longsymlink/';
$longfilename = $dirname . str_repeat("b", 120) . " ";
$symlinkfilename = $dirname . "a";
mkdir($dirname, 0777, true);
touch($longfilename);
symlink($longfilename, $symlinkfilename);
$tar = new Archive_Tar(dirname(__FILE__) . '/testlongsymlink.tar');
$tar->addModify(array($longfilename, $symlinkfilename), '', dirname(__FILE__));
$tar = new Archive_Tar(dirname(__FILE__) . '/testlongsymlink.tar');
$files = $tar->listContent();
$file = end($files);
$lastChar = $file['link'][strlen($file['link']) - 1];
$phpunit->assertEquals(' ', $lastChar, 'should contain space as last character');
echo 'tests done';
?>
--CLEAN--
<?php
$dirname = dirname(__FILE__);
unlink($dirname . '/testlongsymlink.tar');
system("rm -r $dirname/longsymlink");
?>
--EXPECT--
tests done