summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEtienne Kneuss <colder@php.net>2008-06-15 11:47:34 +0000
committerEtienne Kneuss <colder@php.net>2008-06-15 11:47:34 +0000
commit04f211e38f92b09c18eba3fe635e2182d63a8b8d (patch)
tree27e9a9599e62af0c04ecaf3a9ab7d8014396ba3e
parent790f5ee062c3ce6f986916f30ffb1bf77dc1183b (diff)
downloadphp-git-04f211e38f92b09c18eba3fe635e2182d63a8b8d.tar.gz
MFH: Add tests for iterators when instanciated without argument (by Sebastian Schürmann)
-rw-r--r--ext/spl/tests/iterator_056.phpt19
-rw-r--r--ext/spl/tests/iterator_057.phpt21
-rw-r--r--ext/spl/tests/iterator_058.phpt24
-rw-r--r--ext/spl/tests/iterator_059.phpt17
-rw-r--r--ext/spl/tests/iterator_060.phpt17
-rw-r--r--ext/spl/tests/iterator_061.phpt17
-rw-r--r--ext/spl/tests/iterator_062.phpt18
-rw-r--r--ext/spl/tests/iterator_063.phpt17
-rw-r--r--ext/spl/tests/iterator_064.phpt15
-rw-r--r--ext/spl/tests/iterator_065.phpt15
-rw-r--r--ext/spl/tests/iterator_066.phpt15
-rw-r--r--ext/spl/tests/iterator_067.phpt16
12 files changed, 211 insertions, 0 deletions
diff --git a/ext/spl/tests/iterator_056.phpt b/ext/spl/tests/iterator_056.phpt
new file mode 100644
index 0000000000..4b0e75a7d4
--- /dev/null
+++ b/ext/spl/tests/iterator_056.phpt
@@ -0,0 +1,19 @@
+--TEST--
+SPL: FilterIterator::__construct(void)
+--CREDITS--
+Sebastian Schürmann
+--FILE--
+<?php
+class myFilterIterator extends FilterIterator {
+ function accept() {
+
+ }
+}
+try {
+ $it = new myFilterIterator();
+} catch (InvalidArgumentException $e) {
+ echo 'InvalidArgumentException thrown';
+}
+?>
+--EXPECT--
+InvalidArgumentException thrown
diff --git a/ext/spl/tests/iterator_057.phpt b/ext/spl/tests/iterator_057.phpt
new file mode 100644
index 0000000000..602c125015
--- /dev/null
+++ b/ext/spl/tests/iterator_057.phpt
@@ -0,0 +1,21 @@
+--TEST--
+SPL: ArrayIterator::__construct(void)
+--CREDITS--
+Sebastian Schürmann
+--FILE--
+<?php
+/**
+ * From Docs: Construct a new array iterator from anything that has a hash table.
+ * NULL, NOTHING is not a hash table ;)
+ */
+class myArrayIterator extends ArrayIterator {
+}
+try {
+ $it = new myArrayIterator();
+} catch (InvalidArgumentException $e) {
+ echo 'InvalidArgumentException thrown';
+}
+echo 'no Exception thrown'
+?>
+--EXPECT--
+no Exception thrown
diff --git a/ext/spl/tests/iterator_058.phpt b/ext/spl/tests/iterator_058.phpt
new file mode 100644
index 0000000000..3f65ecb7e4
--- /dev/null
+++ b/ext/spl/tests/iterator_058.phpt
@@ -0,0 +1,24 @@
+--TEST--
+SPL: Iterator::__construct(void)
+--CREDITS--
+Sebastian Schürmann
+--FILE--
+<?php
+class myIterator implements Iterator {
+
+ function current() {}
+ function next() {}
+ function key() {}
+ function valid() {}
+ function rewind() {}
+
+}
+try {
+ $it = new myIterator();
+} catch (InvalidArgumentException $e) {
+ echo 'InvalidArgumentException thrown';
+}
+echo 'no Exception thrown';
+?>
+--EXPECT--
+no Exception thrown
diff --git a/ext/spl/tests/iterator_059.phpt b/ext/spl/tests/iterator_059.phpt
new file mode 100644
index 0000000000..8c579ae43a
--- /dev/null
+++ b/ext/spl/tests/iterator_059.phpt
@@ -0,0 +1,17 @@
+--TEST--
+SPL: CachingIterator::__construct(void)
+--CREDITS--
+Sebastian Schürmann
+--FILE--
+<?php
+class myCachingIterator extends CachingIterator {
+
+}
+try {
+ $it = new myCachingIterator();
+} catch (InvalidArgumentException $e) {
+ echo 'InvalidArgumentException thrown';
+}
+?>
+--EXPECT--
+InvalidArgumentException thrown
diff --git a/ext/spl/tests/iterator_060.phpt b/ext/spl/tests/iterator_060.phpt
new file mode 100644
index 0000000000..0c3b6c21d2
--- /dev/null
+++ b/ext/spl/tests/iterator_060.phpt
@@ -0,0 +1,17 @@
+--TEST--
+SPL: RecursiveCachingIterator::__construct(void)
+--CREDITS--
+Sebastian Schürmann
+--FILE--
+<?php
+class myRecursiveCachingIterator extends RecursiveCachingIterator {
+
+}
+try {
+ $it = new myRecursiveCachingIterator();
+} catch (InvalidArgumentException $e) {
+ echo 'InvalidArgumentException thrown';
+}
+?>
+--EXPECT--
+InvalidArgumentException thrown
diff --git a/ext/spl/tests/iterator_061.phpt b/ext/spl/tests/iterator_061.phpt
new file mode 100644
index 0000000000..472f8da196
--- /dev/null
+++ b/ext/spl/tests/iterator_061.phpt
@@ -0,0 +1,17 @@
+--TEST--
+SPL: ParentIterator::__construct(void)
+--CREDITS--
+Sebastian Schürmann
+--FILE--
+<?php
+class myParentIterator extends ParentIterator {
+
+}
+try {
+ $it = new myParentIterator();
+} catch (InvalidArgumentException $e) {
+ echo 'InvalidArgumentException thrown';
+}
+?>
+--EXPECT--
+InvalidArgumentException thrown
diff --git a/ext/spl/tests/iterator_062.phpt b/ext/spl/tests/iterator_062.phpt
new file mode 100644
index 0000000000..59a1dfacf0
--- /dev/null
+++ b/ext/spl/tests/iterator_062.phpt
@@ -0,0 +1,18 @@
+--TEST--
+SPL: RecursiveIteratorIterator::__construct(void)
+--CREDITS--
+Sebastian Schürmann
+--FILE--
+<?php
+class myRecursiveIteratorIterator extends RecursiveIteratorIterator {
+
+}
+
+try {
+ $it = new myRecursiveIteratorIterator();
+} catch (InvalidArgumentException $e) {
+ echo 'InvalidArgumentException thrown';
+}
+?>
+--EXPECT--
+InvalidArgumentException thrown
diff --git a/ext/spl/tests/iterator_063.phpt b/ext/spl/tests/iterator_063.phpt
new file mode 100644
index 0000000000..4d4112bac5
--- /dev/null
+++ b/ext/spl/tests/iterator_063.phpt
@@ -0,0 +1,17 @@
+--TEST--
+SPL: LimitIterator::__construct(void)
+--CREDITS--
+Sebastian Schürmann
+--FILE--
+<?php
+class myLimitIterator extends LimitIterator {
+
+}
+try {
+ $it = new myLimitIterator();
+} catch (InvalidArgumentException $e) {
+ echo 'InvalidArgumentException thrown';
+}
+?>
+--EXPECT--
+InvalidArgumentException thrown
diff --git a/ext/spl/tests/iterator_064.phpt b/ext/spl/tests/iterator_064.phpt
new file mode 100644
index 0000000000..6a62e6c9c5
--- /dev/null
+++ b/ext/spl/tests/iterator_064.phpt
@@ -0,0 +1,15 @@
+--TEST--
+SPL: CachingIterator::__construct(void)
+--CREDITS--
+Sebastian Schürmann
+--FILE--
+<?php
+class myCachingIterator extends CachingIterator {}
+try {
+ $it = new myCachingIterator();
+} catch (InvalidArgumentException $e) {
+ echo 'InvalidArgumentException thrown';
+}
+?>
+--EXPECT--
+InvalidArgumentException thrown
diff --git a/ext/spl/tests/iterator_065.phpt b/ext/spl/tests/iterator_065.phpt
new file mode 100644
index 0000000000..9ea2974cd4
--- /dev/null
+++ b/ext/spl/tests/iterator_065.phpt
@@ -0,0 +1,15 @@
+--TEST--
+SPL: RecursiveCachingIterator::__construct(void)
+--CREDITS--
+Sebastian Schürmann
+--FILE--
+<?php
+class myRecursiveCachingIterator extends RecursiveCachingIterator {}
+try {
+ $it = new myRecursiveCachingIterator();
+} catch (InvalidArgumentException $e) {
+ echo 'InvalidArgumentException thrown';
+}
+?>
+--EXPECT--
+InvalidArgumentException thrown
diff --git a/ext/spl/tests/iterator_066.phpt b/ext/spl/tests/iterator_066.phpt
new file mode 100644
index 0000000000..008c47ccc5
--- /dev/null
+++ b/ext/spl/tests/iterator_066.phpt
@@ -0,0 +1,15 @@
+--TEST--
+SPL: NoRewindIterator::__construct(void)
+--CREDITS--
+Sebastian Schürmann
+--FILE--
+<?php
+class myNoRewindIterator extends NoRewindIterator {}
+try {
+ $it = new myNoRewindIterator();
+} catch (InvalidArgumentException $e) {
+ echo 'InvalidArgumentException thrown';
+}
+?>
+--EXPECT--
+InvalidArgumentException thrown
diff --git a/ext/spl/tests/iterator_067.phpt b/ext/spl/tests/iterator_067.phpt
new file mode 100644
index 0000000000..e05a48d4e0
--- /dev/null
+++ b/ext/spl/tests/iterator_067.phpt
@@ -0,0 +1,16 @@
+--TEST--
+SPL: AppendIterator::__construct(void)
+--CREDITS--
+Sebastian Schürmann
+--FILE--
+<?php
+class myAppendIterator extends AppendIterator {}
+try {
+ $it = new myAppendIterator();
+ echo "no exception";
+} catch (InvalidArgumentException $e) {
+ echo 'InvalidArgumentException thrown';
+}
+?>
+--EXPECT--
+no exception