summaryrefslogtreecommitdiff
path: root/ext/phar/tests/mounteddir.phpt
diff options
context:
space:
mode:
authorGreg Beaver <cellog@php.net>2008-04-26 05:28:56 +0000
committerGreg Beaver <cellog@php.net>2008-04-26 05:28:56 +0000
commitc5fc383cb7fc5705b797448561433a1460bd515f (patch)
tree9e469ab5570cecd7ef654c4294ab7138d0652039 /ext/phar/tests/mounteddir.phpt
parentdbb4618bd5900a505c76f67f9b9c5c49f92b1833 (diff)
downloadphp-git-c5fc383cb7fc5705b797448561433a1460bd515f.tar.gz
finish code coverage work (whew)
Diffstat (limited to 'ext/phar/tests/mounteddir.phpt')
-rw-r--r--ext/phar/tests/mounteddir.phpt39
1 files changed, 39 insertions, 0 deletions
diff --git a/ext/phar/tests/mounteddir.phpt b/ext/phar/tests/mounteddir.phpt
index eee69da959..c438eefb1d 100644
--- a/ext/phar/tests/mounteddir.phpt
+++ b/ext/phar/tests/mounteddir.phpt
@@ -12,15 +12,20 @@ $pname = 'phar://' . $fname;
$a = new Phar($fname);
$a['index.php'] = '<?php
Phar::mount("testit", dirname(Phar::running(0)) . "/testit");
+echo file_get_contents(Phar::running(1) . "/testit/extfile.php"), "\n";
+echo file_get_contents(Phar::running(1) . "/testit/directory"), "\n";
+echo file_get_contents(Phar::running(1) . "/testit/existing.txt"), "\n";
include "testit/extfile.php";
include "testit/extfile2.php";
?>';
+$a['testit/existing.txt'] = 'oops';
$a->setStub('<?php
set_include_path("phar://" . __FILE__);
include "index.php";
__HALT_COMPILER();');
unset($a);
mkdir(dirname(__FILE__) . '/testit');
+mkdir(dirname(__FILE__) . '/testit/directory');
file_put_contents(dirname(__FILE__) . '/testit/extfile.php', '<?php
var_dump(__FILE__);
?>');
@@ -47,6 +52,26 @@ sort($out);
foreach ($out as $b) {
echo "$b\n";
}
+try {
+Phar::mount($pname . '/testit', 'another\\..\\mistake');
+} catch (Exception $e) {
+echo $e->getMessage(), "\n";
+}
+try {
+Phar::mount($pname . '/notfound', dirname(__FILE__) . '/this/does/not/exist');
+} catch (Exception $e) {
+echo $e->getMessage(), "\n";
+}
+try {
+Phar::mount($pname . '/testit', dirname(__FILE__));
+} catch (Exception $e) {
+echo $e->getMessage(), "\n";
+}
+try {
+Phar::mount($pname . '/testit/extfile.php', dirname(__FILE__));
+} catch (Exception $e) {
+echo $e->getMessage(), "\n";
+}
?>
===DONE===
--CLEAN--
@@ -54,17 +79,31 @@ foreach ($out as $b) {
@unlink(dirname(__FILE__) . '/tempmanifest1.phar.php');
@unlink(dirname(__FILE__) . '/testit/extfile.php');
@unlink(dirname(__FILE__) . '/testit/extfile2.php');
+@rmdir(dirname(__FILE__) . '/testit/directory');
@rmdir(dirname(__FILE__) . '/testit');
?>
--EXPECTF--
string(%d) "%sextfile.php"
+<?php
+var_dump(__FILE__);
+?>
+
+Warning: file_get_contents(phar://%stempmanifest1.phar.php/testit/directory): failed to open stream: phar error: path "testit/directory" is a directory in phar://%stempmanifest1.phar.php/index.php on line %d
+
+oops
string(%d) "phar://%sextfile.php"
string(%d) "phar://%sextfile2.php"
.
..
+directory
extfile.php
extfile2.php
+phar://%stempmanifest1.phar.php/testit%cdirectory
phar://%stempmanifest1.phar.php/testit%cextfile.php
phar://%stempmanifest1.phar.php/testit%cextfile2.php
+Mounting of /testit to another\..\mistake within phar %stempmanifest1.phar.php failed
+Mounting of /notfound to %stests/this/does/not/exist within phar %stempmanifest1.phar.php failed
+Mounting of /testit to %stests within phar %stests/tempmanifest1.phar.php failed
+Mounting of /testit/extfile.php to %stests within phar %stests/tempmanifest1.phar.php failed
===DONE=== \ No newline at end of file