diff options
| author | Mark A. Hershberger <mah@debian.(none)> | 2009-03-25 00:36:21 -0400 |
|---|---|---|
| committer | Mark A. Hershberger <mah@debian.(none)> | 2009-03-25 00:36:21 -0400 |
| commit | d29a4fd2dd3b5d4cf6e80b602544d7b71d794e76 (patch) | |
| tree | b38e2e5c6974b9a15f103e5cf884cba9fff90ef4 /ext/spl/tests/fileobject_003.phpt | |
| parent | a88a88d0986a4a32288c102cdbfebd78d7e91d99 (diff) | |
| download | php-upstream/5.2.0.tar.gz | |
Imported Upstream version 5.2.0upstream/5.2.0
Diffstat (limited to 'ext/spl/tests/fileobject_003.phpt')
| -rwxr-xr-x | ext/spl/tests/fileobject_003.phpt | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/ext/spl/tests/fileobject_003.phpt b/ext/spl/tests/fileobject_003.phpt new file mode 100755 index 000000000..74f2002d0 --- /dev/null +++ b/ext/spl/tests/fileobject_003.phpt @@ -0,0 +1,89 @@ +--TEST-- +SPL: SplFileInfo cloning +--SKIPIF-- +<?php if (!extension_loaded("spl")) print "skip"; ?> +--FILE-- +<?php + +function test($name, $lc, $lp) +{ + static $i = 0; + echo "===$i===\n"; + $i++; + + $o = new SplFileInfo($name); + + var_dump($o); + $c = clone $o; + var_dump($c); + var_dump($o === $c); + var_dump($o == $c); + var_dump($o->getPathname() == $c->getPathname()); + + $f = new SplFileObject($name); + var_dump($name); + var_dump($f->getPathName()); + $l = substr($f->getPathName(), -1); + var_dump($l != '/' && $l != '\\' && $l == $lc); + var_dump($f->getFileName()); + $l = substr($f->getFileName(), -1); + var_dump($l != '/' && $l != '\\' && $l == $lc); + var_dump($f->getPath()); + $l = substr($f->getPath(), -1); + var_dump($l != '/' && $l != '\\' && $l == $lp); +} + +test(dirname(__FILE__) . '/' . 'fileobject_001a.txt', 't', substr(dirname(__FILE__),-1)); +test(dirname(__FILE__) . '/', substr(dirname(__FILE__),-1), 'l'); +test(dirname(__FILE__), substr(dirname(__FILE__),-1), 'l'); + +?> +===DONE=== +<?php exit(0); ?> +--EXPECTF-- +===0=== +object(SplFileInfo)#%d (0) { +} +object(SplFileInfo)#%d (0) { +} +bool(false) +bool(true) +bool(true) +string(%d) "%sfileobject_001a.txt" +string(%d) "%sfileobject_001a.txt" +bool(true) +string(%d) "%sfileobject_001a.txt" +bool(true) +string(%d) "%stests" +bool(true) +===1=== +object(SplFileInfo)#%d (0) { +} +object(SplFileInfo)#%d (0) { +} +bool(false) +bool(true) +bool(true) +string(%d) "%stests/" +string(%d) "%stests" +bool(true) +string(%d) "%stests" +bool(true) +string(%d) "%sspl" +bool(true) +===2=== +object(SplFileInfo)#1 (0) { +} +object(SplFileInfo)#2 (0) { +} +bool(false) +bool(true) +bool(true) +string(%d) "%stests" +string(%d) "%stests" +bool(true) +string(%d) "%stests" +bool(true) +string(%d) "%sspl" +bool(true) +===DONE=== |
