ben Tue, 15 Jun 2010 10:50:53 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=300463
Log:
Tests for SplTempFileObject
Basic usage (no params)
Basic usage (with max memory specified)
Variation (passing a neg value to the constructor)
Error (Passing a non long int value to constructor)
Changed paths:
A php/php-src/trunk/ext/spl/tests/SplTempFileObject_constructor_basic.phpt
A php/php-src/trunk/ext/spl/tests/SplTempFileObject_constructor_error.phpt
A
php/php-src/trunk/ext/spl/tests/SplTempFileObject_constructor_maxmemory_basic.phpt
A
php/php-src/trunk/ext/spl/tests/SplTempFileObject_constructor_memory_lt1_variation.phpt
Added: php/php-src/trunk/ext/spl/tests/SplTempFileObject_constructor_basic.phpt
===================================================================
--- php/php-src/trunk/ext/spl/tests/SplTempFileObject_constructor_basic.phpt
(rev 0)
+++ php/php-src/trunk/ext/spl/tests/SplTempFileObject_constructor_basic.phpt
2010-06-15 10:50:53 UTC (rev 300463)
@@ -0,0 +1,19 @@
+--TEST--
+SPL SplTempFileObject constructor sets correct defaults when pass 0 arguments
+--FILE--
+<?php
+var_dump(new SplTempFileObject());
+?>
+--EXPECTF--
+object(SplTempFileObject)#1 (5) {
+ ["pathName":"SplFileInfo":private]=>
+ string(10) "php://temp"
+ ["fileName":"SplFileInfo":private]=>
+ string(10) "php://temp"
+ ["openMode":"SplFileObject":private]=>
+ string(1) "w"
+ ["delimiter":"SplFileObject":private]=>
+ string(1) ","
+ ["enclosure":"SplFileObject":private]=>
+ string(1) """
+}
Added: php/php-src/trunk/ext/spl/tests/SplTempFileObject_constructor_error.phpt
===================================================================
--- php/php-src/trunk/ext/spl/tests/SplTempFileObject_constructor_error.phpt
(rev 0)
+++ php/php-src/trunk/ext/spl/tests/SplTempFileObject_constructor_error.phpt
2010-06-15 10:50:53 UTC (rev 300463)
@@ -0,0 +1,12 @@
+--TEST--
+SPL SplTempFileObject constructor sets correct defaults when pass 0 arguments
+--FILE--
+<?php
+new SplTempFileObject('invalid');
+?>
+--EXPECTF--
+Fatal error: Uncaught exception 'RuntimeException' with message
'SplTempFileObject::__construct() expects parameter 1 to be long, string given'
in %s
+Stack trace:
+#0 %s: SplTempFileObject->__construct('invalid')
+#1 {main}
+ thrown in %s
Added:
php/php-src/trunk/ext/spl/tests/SplTempFileObject_constructor_maxmemory_basic.phpt
===================================================================
---
php/php-src/trunk/ext/spl/tests/SplTempFileObject_constructor_maxmemory_basic.phpt
(rev 0)
+++
php/php-src/trunk/ext/spl/tests/SplTempFileObject_constructor_maxmemory_basic.phpt
2010-06-15 10:50:53 UTC (rev 300463)
@@ -0,0 +1,19 @@
+--TEST--
+SPL SplTempFileObject constructor sets correct values when passed fixed memory
size
+--FILE--
+<?php
+var_dump(new SplTempFileObject(1024));
+?>
+--EXPECTF--
+object(SplTempFileObject)#1 (5) {
+ ["pathName":"SplFileInfo":private]=>
+ string(25) "php://temp/maxmemory:1024"
+ ["fileName":"SplFileInfo":private]=>
+ string(25) "php://temp/maxmemory:1024"
+ ["openMode":"SplFileObject":private]=>
+ string(1) "w"
+ ["delimiter":"SplFileObject":private]=>
+ string(1) ","
+ ["enclosure":"SplFileObject":private]=>
+ string(1) """
+}
Added:
php/php-src/trunk/ext/spl/tests/SplTempFileObject_constructor_memory_lt1_variation.phpt
===================================================================
---
php/php-src/trunk/ext/spl/tests/SplTempFileObject_constructor_memory_lt1_variation.phpt
(rev 0)
+++
php/php-src/trunk/ext/spl/tests/SplTempFileObject_constructor_memory_lt1_variation.phpt
2010-06-15 10:50:53 UTC (rev 300463)
@@ -0,0 +1,19 @@
+--TEST--
+SPL SplTempFileObject constructor sets correct defaults when passed a negative
value
+--FILE--
+<?php
+var_dump(new SplTempFileObject(-1));
+?>
+--EXPECTF--
+object(SplTempFileObject)#1 (5) {
+ ["pathName":"SplFileInfo":private]=>
+ string(12) "php://memory"
+ ["fileName":"SplFileInfo":private]=>
+ string(12) "php://memory"
+ ["openMode":"SplFileObject":private]=>
+ string(1) "w"
+ ["delimiter":"SplFileObject":private]=>
+ string(1) ","
+ ["enclosure":"SplFileObject":private]=>
+ string(1) """
+}
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php