From d1c912628de9db04129c567e61cc3013edd5680c Mon Sep 17 00:00:00 2001 From: Ben Longden Date: Tue, 15 Jun 2010 11:20:21 +0000 Subject: [PATCH] Merged SplTempFileObject tests from trunk --- .../SplTempFileObject_constructor_basic.phpt | 19 +++++++++++++++++++ .../SplTempFileObject_constructor_error.phpt | 12 ++++++++++++ ...ileObject_constructor_maxmemory_basic.phpt | 19 +++++++++++++++++++ ...ject_constructor_memory_lt1_variation.phpt | 19 +++++++++++++++++++ 4 files changed, 69 insertions(+) create mode 100644 ext/spl/tests/SplTempFileObject_constructor_basic.phpt create mode 100644 ext/spl/tests/SplTempFileObject_constructor_error.phpt create mode 100644 ext/spl/tests/SplTempFileObject_constructor_maxmemory_basic.phpt create mode 100644 ext/spl/tests/SplTempFileObject_constructor_memory_lt1_variation.phpt diff --git a/ext/spl/tests/SplTempFileObject_constructor_basic.phpt b/ext/spl/tests/SplTempFileObject_constructor_basic.phpt new file mode 100644 index 0000000000..b2e640c7ac --- /dev/null +++ b/ext/spl/tests/SplTempFileObject_constructor_basic.phpt @@ -0,0 +1,19 @@ +--TEST-- +SPL SplTempFileObject constructor sets correct defaults when pass 0 arguments +--FILE-- + +--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) """ +} diff --git a/ext/spl/tests/SplTempFileObject_constructor_error.phpt b/ext/spl/tests/SplTempFileObject_constructor_error.phpt new file mode 100644 index 0000000000..d2717ac5ae --- /dev/null +++ b/ext/spl/tests/SplTempFileObject_constructor_error.phpt @@ -0,0 +1,12 @@ +--TEST-- +SPL SplTempFileObject constructor sets correct defaults when pass 0 arguments +--FILE-- + +--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 diff --git a/ext/spl/tests/SplTempFileObject_constructor_maxmemory_basic.phpt b/ext/spl/tests/SplTempFileObject_constructor_maxmemory_basic.phpt new file mode 100644 index 0000000000..2ef1b2cd1a --- /dev/null +++ b/ext/spl/tests/SplTempFileObject_constructor_maxmemory_basic.phpt @@ -0,0 +1,19 @@ +--TEST-- +SPL SplTempFileObject constructor sets correct values when passed fixed memory size +--FILE-- + +--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) """ +} diff --git a/ext/spl/tests/SplTempFileObject_constructor_memory_lt1_variation.phpt b/ext/spl/tests/SplTempFileObject_constructor_memory_lt1_variation.phpt new file mode 100644 index 0000000000..9fe5892113 --- /dev/null +++ b/ext/spl/tests/SplTempFileObject_constructor_memory_lt1_variation.phpt @@ -0,0 +1,19 @@ +--TEST-- +SPL SplTempFileObject constructor sets correct defaults when passed a negative value +--FILE-- + +--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) """ +} -- 2.50.0