diff options
author | Ondřej Surý <ondrej@sury.org> | 2012-01-11 15:43:42 +0100 |
---|---|---|
committer | Ondřej Surý <ondrej@sury.org> | 2012-01-11 15:43:42 +0100 |
commit | 8f1428d29ef91d74b4d272af171675f2971eb15b (patch) | |
tree | a1f4f4d7dc5bfe8096806dd5c5266634e19fa07a /ext/spl/tests | |
parent | c6e4182351e0173fe58de141e143aac2eacf5efe (diff) | |
download | php-8f1428d29ef91d74b4d272af171675f2971eb15b.tar.gz |
Imported Upstream version 5.3.9upstream/5.3.9
Diffstat (limited to 'ext/spl/tests')
-rw-r--r-- | ext/spl/tests/DirectoryIterator_by_reference.phpt | 4 | ||||
-rw-r--r-- | ext/spl/tests/DirectoryIterator_getExtension_basic.phpt | 6 | ||||
-rw-r--r-- | ext/spl/tests/DirectoryIterator_getGroup_basic.phpt | 19 | ||||
-rw-r--r-- | ext/spl/tests/DirectoryIterator_getOwner_basic.phpt | 3 | ||||
-rw-r--r-- | ext/spl/tests/SplFileInfo_getGroup_basic.phpt | 4 | ||||
-rw-r--r-- | ext/spl/tests/SplFileInfo_getOwner_basic.phpt | 4 | ||||
-rw-r--r-- | ext/spl/tests/bug53071.phpt | 53 | ||||
-rw-r--r-- | ext/spl/tests/bug54304.phpt | 26 | ||||
-rw-r--r-- | ext/spl/tests/bug54971.phpt | 4 | ||||
-rwxr-xr-x | ext/spl/tests/bug60082.phpt | 21 | ||||
-rw-r--r-- | ext/spl/tests/spl_autoload_call_basic.phpt | 18 |
11 files changed, 122 insertions, 40 deletions
diff --git a/ext/spl/tests/DirectoryIterator_by_reference.phpt b/ext/spl/tests/DirectoryIterator_by_reference.phpt index 5352a5df1..06127ec37 100644 --- a/ext/spl/tests/DirectoryIterator_by_reference.phpt +++ b/ext/spl/tests/DirectoryIterator_by_reference.phpt @@ -5,10 +5,10 @@ Havard Eide <nucleuz@gmail.com> #PHPTestFest2009 Norway 2009-06-09 \o/ --FILE-- <?php -$it = new DirectoryIterator("/tmp"); +$it = new DirectoryIterator(__DIR__); foreach( $it as &$file ) { echo $file . "\n"; } ?> --EXPECTF-- -Fatal error: An iterator cannot be used with foreach by reference in %s on line %d
\ No newline at end of file +Fatal error: An iterator cannot be used with foreach by reference in %s on line %d diff --git a/ext/spl/tests/DirectoryIterator_getExtension_basic.phpt b/ext/spl/tests/DirectoryIterator_getExtension_basic.phpt index 20ef3bf36..7398d4b9d 100644 --- a/ext/spl/tests/DirectoryIterator_getExtension_basic.phpt +++ b/ext/spl/tests/DirectoryIterator_getExtension_basic.phpt @@ -1,5 +1,11 @@ --TEST-- SPL: DirectoryIterator::getExtension() basic test +--SKIPIF-- +<?php +if (substr(PHP_OS, 0, 3) == 'WIN') { + die('skip.. only for Unix'); +} +?> --FILE-- <?php $dir = __DIR__ . DIRECTORY_SEPARATOR . md5('DirectoryIterator::getExtension') . DIRECTORY_SEPARATOR; diff --git a/ext/spl/tests/DirectoryIterator_getGroup_basic.phpt b/ext/spl/tests/DirectoryIterator_getGroup_basic.phpt index 9cc9fadbe..0c75bf4c0 100644 --- a/ext/spl/tests/DirectoryIterator_getGroup_basic.phpt +++ b/ext/spl/tests/DirectoryIterator_getGroup_basic.phpt @@ -1,15 +1,18 @@ ---TEST--
-SPL: DirectoryIterator test getGroup
---CREDITS--
+--TEST-- +SPL: DirectoryIterator test getGroup +--SKIPIF-- +<?php +if (posix_geteuid() == 0) die('SKIP Cannot run test as root.'); +--CREDITS-- Cesare D'Amico <cesare.damico@gruppovolta.it> Andrea Giorgini <agiorg@gmail.com> Filippo De Santis <fd@ideato.it> Daniel Londero <daniel.londero@gmail.com> Francesco Trucchia <ft@ideato.it> Jacopo Romei <jacopo@sviluppoagile.it> -#Test Fest Cesena (Italy) on 2009-06-20
---FILE--
-<?php
+#Test Fest Cesena (Italy) on 2009-06-20 +--FILE-- +<?php $dirname = 'DirectoryIterator_getGroup_basic'; mkdir($dirname); $dir = new DirectoryIterator($dirname); @@ -21,6 +24,6 @@ var_dump($expected == $actual); <?php $dirname = 'DirectoryIterator_getGroup_basic'; rmdir($dirname); -?>
---EXPECTF--
+?> +--EXPECTF-- bool(true) diff --git a/ext/spl/tests/DirectoryIterator_getOwner_basic.phpt b/ext/spl/tests/DirectoryIterator_getOwner_basic.phpt index c5e9f7c2c..a1092c2fe 100644 --- a/ext/spl/tests/DirectoryIterator_getOwner_basic.phpt +++ b/ext/spl/tests/DirectoryIterator_getOwner_basic.phpt @@ -1,5 +1,8 @@ --TEST-- SPL: DirectoryIterator test getOwner +--SKIPIF-- +<?php +if (posix_geteuid() == 0) die('SKIP Cannot run test as root.'); --CREDITS-- Cesare D'Amico <cesare.damico@gruppovolta.it> Andrea Giorgini <agiorg@gmail.com> diff --git a/ext/spl/tests/SplFileInfo_getGroup_basic.phpt b/ext/spl/tests/SplFileInfo_getGroup_basic.phpt index c5808c57d..d27993563 100644 --- a/ext/spl/tests/SplFileInfo_getGroup_basic.phpt +++ b/ext/spl/tests/SplFileInfo_getGroup_basic.phpt @@ -10,7 +10,7 @@ Jacopo Romei <jacopo@sviluppoagile.it> #Test Fest Cesena (Italy) on 2009-06-20 --FILE-- <?php -$filename = basename(__FILE__, 'phpt').'tmp'; +$filename = __DIR__ . "/SplFileInfo_getGroup_basic"; touch($filename); $fileInfo = new SplFileInfo($filename); $expected = filegroup($filename); @@ -19,7 +19,7 @@ var_dump($expected == $actual); ?> --CLEAN-- <?php -$filename = basename(__FILE__, 'phpt').'tmp'; +$filename = __DIR__ . "/SplFileInfo_getGroup_basic"; unlink($filename); ?> --EXPECTF-- diff --git a/ext/spl/tests/SplFileInfo_getOwner_basic.phpt b/ext/spl/tests/SplFileInfo_getOwner_basic.phpt index 790dcc69b..3df8e4858 100644 --- a/ext/spl/tests/SplFileInfo_getOwner_basic.phpt +++ b/ext/spl/tests/SplFileInfo_getOwner_basic.phpt @@ -10,7 +10,7 @@ Jacopo Romei <jacopo@sviluppoagile.it> #Test Fest Cesena (Italy) on 2009-06-20 --FILE-- <?php -$filename = basename(__FILE__, 'phpt').'tmp'; +$filename = __DIR__ . "/SplFileInfo_getOwner_basic"; touch($filename); $fileInfo = new SplFileInfo($filename); $expected = fileowner($filename); @@ -19,7 +19,7 @@ var_dump($expected == $actual); ?> --CLEAN-- <?php -$filename = basename(__FILE__, 'phpt').'tmp'; +$filename = __DIR__ . "/SplFileInfo_getOwner_basic"; unlink($filename); ?> --EXPECTF-- diff --git a/ext/spl/tests/bug53071.phpt b/ext/spl/tests/bug53071.phpt index b0ea3aad8..c2c2605e2 100644 --- a/ext/spl/tests/bug53071.phpt +++ b/ext/spl/tests/bug53071.phpt @@ -1,26 +1,27 @@ ---TEST--
-Bug #53071 (Usage of SPLObjectStorage defeats gc_collect_cycles)
---FILE--
-<?php
-class myClass
-{
- public $member;
-}
-function LimitedScope()
-{
- $myA = new myClass();
- $myB = new SplObjectStorage();
- $myC = new myClass();
- $myC->member = $myA; // myC has a referece to myA
- $myB->Attach($myC); // myB attaches myC
- $myA->member = $myB; // myA has myB, comleting the cycle
-}
-LimitedScope();
-var_dump(gc_collect_cycles());
-
-echo "Done.\n";
-
-?>
---EXPECTF--
-int(5)
-Done.
+--TEST-- +Bug #53071 (Usage of SPLObjectStorage defeats gc_collect_cycles) +--FILE-- +<?php +gc_enable(); +class myClass +{ + public $member; +} +function LimitedScope() +{ + $myA = new myClass(); + $myB = new SplObjectStorage(); + $myC = new myClass(); + $myC->member = $myA; // myC has a referece to myA + $myB->Attach($myC); // myB attaches myC + $myA->member = $myB; // myA has myB, comleting the cycle +} +LimitedScope(); +var_dump(gc_collect_cycles()); + +echo "Done.\n"; + +?> +--EXPECTF-- +int(5) +Done. diff --git a/ext/spl/tests/bug54304.phpt b/ext/spl/tests/bug54304.phpt new file mode 100644 index 000000000..32cbe486a --- /dev/null +++ b/ext/spl/tests/bug54304.phpt @@ -0,0 +1,26 @@ +--TEST-- +Bug #54304 (Setting replacement value for RegexIterator doesn't work) +--FILE-- +<?php +class foo extends ArrayIterator { + public function __construct( ) { + parent::__construct(array( + 'test3'=>'test999')); + } +} + +$h = new foo; +$i = new RegexIterator($h, '/^test(.*)/', RegexIterator::REPLACE); +$i->replacement = 42; +var_dump($i->replacement); +foreach ($i as $name=>$value) { + var_dump($name, $value); +} +var_dump($i->replacement); +?> +--EXPECT-- +int(42) +string(5) "test3" +string(2) "42" +int(42) + diff --git a/ext/spl/tests/bug54971.phpt b/ext/spl/tests/bug54971.phpt index 166613b43..07a470627 100644 --- a/ext/spl/tests/bug54971.phpt +++ b/ext/spl/tests/bug54971.phpt @@ -1,5 +1,9 @@ --TEST-- Bug #54971 (Wrong result when using iterator_to_array with use_keys on true) +--SKIPIF-- +<?php +if (!extension_loaded('dom')) die("skip this test needs --enable-dom"); +?> --FILE-- <?php diff --git a/ext/spl/tests/bug60082.phpt b/ext/spl/tests/bug60082.phpt new file mode 100755 index 000000000..7aff2c416 --- /dev/null +++ b/ext/spl/tests/bug60082.phpt @@ -0,0 +1,21 @@ +--TEST-- +Bug #60082 (100% CPU / when using references with ArrayObject(&$ref)) +--SKIPIF-- +<?php +if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); +if ((stristr(PHP_OS, 'freebsd'))) { + die('skip.. this test causes the run-tests.php to hang on Freebsd, see #60186'); +} +?> +--FILE-- +<?php +$test = array(); +$test = new ArrayObject(&$test); +$test['a'] = $test['b']; +?> +===DONE=== +<?php exit(0); ?> +--EXPECTF-- +Deprecated: Call-time pass-by-reference has been deprecated in %sbug60082.php on line %d + +Fatal error: main(): Array was modified outside object and made a recursive object in %sbug60082.php on line %d diff --git a/ext/spl/tests/spl_autoload_call_basic.phpt b/ext/spl/tests/spl_autoload_call_basic.phpt new file mode 100644 index 000000000..2bd65c22b --- /dev/null +++ b/ext/spl/tests/spl_autoload_call_basic.phpt @@ -0,0 +1,18 @@ +--TEST-- +spl_autoload_call() function - basic test for spl_autoload_call() +--CREDITS-- +Jean-Marc Fontaine <jean-marc.fontaine@alterway.fr> +# Alter Way Contribution Day 2011 +--FILE-- +<?php +function customAutolader($class) { + require_once __DIR__ . '/testclass.class.inc'; +} +spl_autoload_register('customAutolader'); + +spl_autoload_call('TestClass'); +var_dump(class_exists('TestClass', false)); +?> +--EXPECTF-- +%stestclass.class.inc +bool(true) |