]> granicus.if.org Git - php/commitdiff
MFH: Add tests for iterators when instanciated without argument (by Sebastian SchÃ...
authorEtienne Kneuss <colder@php.net>
Sun, 15 Jun 2008 11:47:34 +0000 (11:47 +0000)
committerEtienne Kneuss <colder@php.net>
Sun, 15 Jun 2008 11:47:34 +0000 (11:47 +0000)
12 files changed:
ext/spl/tests/iterator_056.phpt [new file with mode: 0644]
ext/spl/tests/iterator_057.phpt [new file with mode: 0644]
ext/spl/tests/iterator_058.phpt [new file with mode: 0644]
ext/spl/tests/iterator_059.phpt [new file with mode: 0644]
ext/spl/tests/iterator_060.phpt [new file with mode: 0644]
ext/spl/tests/iterator_061.phpt [new file with mode: 0644]
ext/spl/tests/iterator_062.phpt [new file with mode: 0644]
ext/spl/tests/iterator_063.phpt [new file with mode: 0644]
ext/spl/tests/iterator_064.phpt [new file with mode: 0644]
ext/spl/tests/iterator_065.phpt [new file with mode: 0644]
ext/spl/tests/iterator_066.phpt [new file with mode: 0644]
ext/spl/tests/iterator_067.phpt [new file with mode: 0644]

diff --git a/ext/spl/tests/iterator_056.phpt b/ext/spl/tests/iterator_056.phpt
new file mode 100644 (file)
index 0000000..4b0e75a
--- /dev/null
@@ -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 (file)
index 0000000..602c125
--- /dev/null
@@ -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 (file)
index 0000000..3f65ecb
--- /dev/null
@@ -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 (file)
index 0000000..8c579ae
--- /dev/null
@@ -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 (file)
index 0000000..0c3b6c2
--- /dev/null
@@ -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 (file)
index 0000000..472f8da
--- /dev/null
@@ -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 (file)
index 0000000..59a1dfa
--- /dev/null
@@ -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 (file)
index 0000000..4d4112b
--- /dev/null
@@ -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 (file)
index 0000000..6a62e6c
--- /dev/null
@@ -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 (file)
index 0000000..9ea2974
--- /dev/null
@@ -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 (file)
index 0000000..008c47c
--- /dev/null
@@ -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 (file)
index 0000000..e05a48d
--- /dev/null
@@ -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