diff --git a/ext/pdo/tests/PDO_getAvailableDrivers_basic.phpt b/ext/pdo/tests/PDO_getAvailableDrivers_basic.phpt new file mode 100644 index 000000000000..fd7e2819d334 --- /dev/null +++ b/ext/pdo/tests/PDO_getAvailableDrivers_basic.phpt @@ -0,0 +1,15 @@ +--TEST-- +PDO::getAvailableDrivers basic +--SKIPIF-- + +--FILE-- + +--EXPECT-- +Array +( + [0] => sqlite +) diff --git a/ext/pdo/tests/PDO_getAvailableDrivers_error001.phpt b/ext/pdo/tests/PDO_getAvailableDrivers_error001.phpt new file mode 100644 index 000000000000..77b1cddc5933 --- /dev/null +++ b/ext/pdo/tests/PDO_getAvailableDrivers_error001.phpt @@ -0,0 +1,12 @@ +--TEST-- +PDO::getAvailableDrivers error when argument supplied +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Warning: PDO::getAvailableDrivers() expects exactly 0 parameters, 1 given in %s on line %d diff --git a/ext/spl/tests/SplFileObject_current_basic.phpt b/ext/spl/tests/SplFileObject_current_basic.phpt new file mode 100644 index 000000000000..d3f4802a5389 --- /dev/null +++ b/ext/spl/tests/SplFileObject_current_basic.phpt @@ -0,0 +1,18 @@ +--TEST-- +SPL: SplFileObject::current basic +--CREDITS-- +Ricardo Oedietram +Erwin Poeze +#PFZ June PHP TestFest 2012 +--FILE-- +current(); + +?> +--EXPECT-- + +Erwin Poeze +#PFZ June PHP TestFest 2012 +--FILE-- +seek(2); + +echo $s->current('foo'); +?> +--EXPECTF-- +Warning: SplFileObject::current() expects exactly 0 parameters, 1 given in %s on line %d diff --git a/ext/spl/tests/SplFileObject_current_variation001.phpt b/ext/spl/tests/SplFileObject_current_variation001.phpt new file mode 100644 index 000000000000..0cc588a7f047 --- /dev/null +++ b/ext/spl/tests/SplFileObject_current_variation001.phpt @@ -0,0 +1,21 @@ +--TEST-- +SPL: SplFileObject::current variation +--CREDITS-- +Ricardo Oedietram +Erwin Poeze +#PFZ June PHP TestFest 2012 +--FILE-- +seek(2); + +echo $s->current(); +echo $s->current(); +?> +--EXPECT-- +//line 3 +//line 3 diff --git a/ext/spl/tests/SplFileObject_getchildren_basic.phpt b/ext/spl/tests/SplFileObject_getchildren_basic.phpt new file mode 100644 index 000000000000..065e8eae45a2 --- /dev/null +++ b/ext/spl/tests/SplFileObject_getchildren_basic.phpt @@ -0,0 +1,12 @@ +--TEST-- +SPL: SplFileObject::getchildren basic +--CREDITS-- +Erwin Poeze +--FILE-- +getChildren()); + +?> +--EXPECT-- +NULL diff --git a/ext/spl/tests/SplFileObject_getchildren_error001.phpt b/ext/spl/tests/SplFileObject_getchildren_error001.phpt new file mode 100644 index 000000000000..9c17a8297745 --- /dev/null +++ b/ext/spl/tests/SplFileObject_getchildren_error001.phpt @@ -0,0 +1,12 @@ +--TEST-- +SPL: SplFileObject::getchildren error 001 +--CREDITS-- +Erwin Poeze +--FILE-- +getChildren('string'); + +?> +--EXPECTF-- +Warning: SplFileObject::getChildren() expects exactly 0 parameters, 1 given in %s on line %d diff --git a/ext/spl/tests/SplFileObject_getflags_basic.phpt b/ext/spl/tests/SplFileObject_getflags_basic.phpt new file mode 100644 index 000000000000..5addadf38046 --- /dev/null +++ b/ext/spl/tests/SplFileObject_getflags_basic.phpt @@ -0,0 +1,22 @@ +--TEST-- +SPL: SplFileObject::getFlags basic +--CREDITS-- +Ricardo Oedietram +Erwin Poeze +#PFZ June PHP TestFest 2012 +--FILE-- +setFlags(SplFileObject::DROP_NEW_LINE); +var_dump($fo->getFlags()); +?> +--CLEAN-- + +--EXPECT-- +int(1) diff --git a/ext/spl/tests/SplFileObject_getflags_error001.phpt b/ext/spl/tests/SplFileObject_getflags_error001.phpt new file mode 100644 index 000000000000..1602f88885e1 --- /dev/null +++ b/ext/spl/tests/SplFileObject_getflags_error001.phpt @@ -0,0 +1,26 @@ +--TEST-- +SPL: SplFileObject::getFlags error 001 +--CREDITS-- +Ricardo Oedietram +Erwin Poeze +#PFZ June PHP TestFest 2012 +--FILE-- +setFlags(SplFileObject::READ_CSV); + +$fo->setFlags(SplFileObject::DROP_NEW_LINE); + +var_dump($fo->getFlags()); + +?> +--CLEAN-- + +--EXPECT-- +int(1) diff --git a/ext/spl/tests/SplFileObject_getflags_error002.phpt b/ext/spl/tests/SplFileObject_getflags_error002.phpt new file mode 100644 index 000000000000..e2c8255f4496 --- /dev/null +++ b/ext/spl/tests/SplFileObject_getflags_error002.phpt @@ -0,0 +1,21 @@ +--TEST-- +SPL: SplFileObject::getFlags error 001 +--CREDITS-- +Erwin Poeze +--FILE-- +setFlags(SplFileObject::READ_CSV); + +$fo->getFlags('fake'); + +?> +--CLEAN-- + +--EXPECTF-- +Warning: SplFileObject::getFlags() expects exactly 0 parameters, 1 given in %s on line %d diff --git a/ext/spl/tests/SplFileObject_getflags_variation001.phpt b/ext/spl/tests/SplFileObject_getflags_variation001.phpt new file mode 100644 index 000000000000..640de03511d6 --- /dev/null +++ b/ext/spl/tests/SplFileObject_getflags_variation001.phpt @@ -0,0 +1,29 @@ +--TEST-- +SPL: SplFileObject::getFlags +--CREDITS-- +Ricardo Oedietram +Erwin Poeze +#PFZ June PHP TestFest 2012 +--FILE-- +setFlags(SplFileObject::DROP_NEW_LINE); +var_dump($fo->getFlags()); + +$fo->setFlags(SplFileObject::READ_AHEAD); +var_dump($fo->getFlags()); + +$fo->setFlags(SplFileObject::SKIP_EMPTY); +var_dump($fo->getFlags()); + +$fo->setFlags(SplFileObject::READ_CSV); +var_dump($fo->getFlags()); + +?> +--EXPECT-- +int(1) +int(2) +int(4) +int(8) diff --git a/ext/spl/tests/SplFileObject_haschildren_basic.phpt b/ext/spl/tests/SplFileObject_haschildren_basic.phpt new file mode 100644 index 000000000000..1ce00bfd42b1 --- /dev/null +++ b/ext/spl/tests/SplFileObject_haschildren_basic.phpt @@ -0,0 +1,12 @@ +--TEST-- +SPL: SplFileObject::haschildren basic +--CREDITS-- +Erwin Poeze +--FILE-- +hasChildren()); + +?> +--EXPECT-- +bool(false) diff --git a/ext/spl/tests/SplFileObject_haschildren_error001.phpt b/ext/spl/tests/SplFileObject_haschildren_error001.phpt new file mode 100644 index 000000000000..0c4e1de3b776 --- /dev/null +++ b/ext/spl/tests/SplFileObject_haschildren_error001.phpt @@ -0,0 +1,12 @@ +--TEST-- +SPL: SplFileObject::haschildren error 001 +--CREDITS-- +Erwin Poeze +--FILE-- +hasChildren('string'); + +?> +--EXPECTF-- +Warning: SplFileObject::hasChildren() expects exactly 0 parameters, 1 given in %s on line %d diff --git a/ext/spl/tests/SplFileObject_key_basic.phpt b/ext/spl/tests/SplFileObject_key_basic.phpt new file mode 100644 index 000000000000..4081d314eaf0 --- /dev/null +++ b/ext/spl/tests/SplFileObject_key_basic.phpt @@ -0,0 +1,19 @@ +--TEST-- +SPL: SplFileObject::key basic +--CREDITS-- +Ricardo Oedietram +Erwin Poeze +#PFZ June PHP TestFest 2012 +--FILE-- +seek(3); +echo $s->key(); +?> +--EXPECT-- +3 diff --git a/ext/spl/tests/SplFileObject_key_error001.phpt b/ext/spl/tests/SplFileObject_key_error001.phpt new file mode 100644 index 000000000000..b0834f00290a --- /dev/null +++ b/ext/spl/tests/SplFileObject_key_error001.phpt @@ -0,0 +1,22 @@ +--TEST-- +SPL: SplFileObject::key error +--CREDITS-- +Ricardo Oedietram +Erwin Poeze +#PFZ June PHP TestFest 2012 +--FILE-- +seek(12); +$s->next(); +var_dump($s->key()); +var_dump($s->valid()); +?> +--EXPECT-- +int(13) +bool(false) diff --git a/ext/spl/tests/SplFileObject_key_error002.phpt b/ext/spl/tests/SplFileObject_key_error002.phpt new file mode 100644 index 000000000000..8fc9b7fef0a5 --- /dev/null +++ b/ext/spl/tests/SplFileObject_key_error002.phpt @@ -0,0 +1,22 @@ +--TEST-- +SPL: SplFileObject::key error +--CREDITS-- +Ricardo Oedietram +Erwin Poeze +#PFZ June PHP TestFest 2012 +--FILE-- +seek(120); +$s->next(); +var_dump($s->key()); +var_dump($s->valid()); +?> +--EXPECT-- +int(13) +bool(false) diff --git a/ext/spl/tests/SplFileObject_key_error003.phpt b/ext/spl/tests/SplFileObject_key_error003.phpt new file mode 100644 index 000000000000..7568cf55f4e4 --- /dev/null +++ b/ext/spl/tests/SplFileObject_key_error003.phpt @@ -0,0 +1,15 @@ +--TEST-- +SPL: SplFileObject::key error +--CREDITS-- +Erwin Poeze +--FILE-- +key(3); +?> +--EXPECTF-- +Warning: SplFileObject::key() expects exactly 0 parameters, 1 given in %s on line %d diff --git a/ext/spl/tests/SplFileObject_next_basic.phpt b/ext/spl/tests/SplFileObject_next_basic.phpt new file mode 100644 index 000000000000..59dc7ab58d67 --- /dev/null +++ b/ext/spl/tests/SplFileObject_next_basic.phpt @@ -0,0 +1,22 @@ +--TEST-- +SPL: SplFileObject::next basic +--CREDITS-- +Ricardo Oedietram +Erwin Poeze +#PFZ June PHP TestFest 2012 +--FILE-- +current(); +$s->next(); + +echo $s->current(); + +?> +--EXPECT-- + +Erwin Poeze +#PFZ June PHP TestFest 2012 +--FILE-- +seek(13); +echo $s->current(); + +$s->next(); +echo $s->current(); +var_dump($s->valid()); +?> +--EXPECT-- +?> +bool(false) diff --git a/ext/spl/tests/SplFileObject_next_variation002.phpt b/ext/spl/tests/SplFileObject_next_variation002.phpt new file mode 100644 index 000000000000..d48ff8c22371 --- /dev/null +++ b/ext/spl/tests/SplFileObject_next_variation002.phpt @@ -0,0 +1,30 @@ +--TEST-- +SPL: SplFileObject::next variation 002, read ahead +--CREDITS-- +Ricardo Oedietram +Erwin Poeze +#PFZ June PHP TestFest 2012 +--FILE-- +seek(2); +echo $s->current(); +$s->next(); +echo $s->current(); + +$s->setFlags(SplFileObject::READ_AHEAD); + +$s->seek(2); +echo $s->current(); +$s->next(); +echo $s->current(); +?> +--EXPECT-- +//line 3 +//line 4 +//line 3 +//line 4 diff --git a/ext/spl/tests/SplFileObject_rewind_basic.phpt b/ext/spl/tests/SplFileObject_rewind_basic.phpt new file mode 100644 index 000000000000..331c587e4a24 --- /dev/null +++ b/ext/spl/tests/SplFileObject_rewind_basic.phpt @@ -0,0 +1,21 @@ +--TEST-- +SPL: SplFileObject::rewind basic +--CREDITS-- +Ricardo Oedietram +Erwin Poeze +#PFZ June PHP TestFest 2012 +--FILE-- +seek(3); + +$s->rewind(); +echo $s->current(); +?> +--EXPECT-- + +Erwin Poeze +#PFZ June PHP TestFest 2012 +--FILE-- +rewind( "invalid" ); + +?> +--EXPECTF-- +Warning: SplFileObject::rewind() expects exactly 0 parameters, 1 given in %s on line %d diff --git a/ext/spl/tests/SplFileObject_rewind_variation001.phpt b/ext/spl/tests/SplFileObject_rewind_variation001.phpt new file mode 100644 index 000000000000..d835c443de17 --- /dev/null +++ b/ext/spl/tests/SplFileObject_rewind_variation001.phpt @@ -0,0 +1,28 @@ +--TEST-- +SPL: SplFileObject::rewind variation 001 +--CREDITS-- +Ricardo Oedietram +Erwin Poeze +#PFZ June PHP TestFest 2012 +--FILE-- +seek(15); +echo $s->current(); +$s->next(); +echo $s->current(); +var_dump($s->valid()); +$s->rewind(); +var_dump($s->valid()); +echo $s->current(); +?> +--EXPECT-- +?> +bool(false) +bool(true) + +Erwin Poeze +#PFZ June PHP TestFest 2012 +--FILE-- +seek(2); +echo $s->current(); +?> +--EXPECT-- +//line 3 diff --git a/ext/spl/tests/SplFileObject_seek_error002.phpt b/ext/spl/tests/SplFileObject_seek_error002.phpt new file mode 100644 index 000000000000..057c8d3251ae --- /dev/null +++ b/ext/spl/tests/SplFileObject_seek_error002.phpt @@ -0,0 +1,18 @@ +--TEST-- +SPL: SplFileObject::seek error 001 +--CREDITS-- +Ricardo Oedietram +Erwin Poeze +#PFZ June PHP TestFest 2012 +--FILE-- +seek(20); +echo $s->current(); +?> +--EXPECT-- diff --git a/ext/spl/tests/SplFileObject_setCsvControl_basic.phpt b/ext/spl/tests/SplFileObject_setCsvControl_basic.phpt new file mode 100644 index 000000000000..b2630606e8ea --- /dev/null +++ b/ext/spl/tests/SplFileObject_setCsvControl_basic.phpt @@ -0,0 +1,30 @@ +--TEST-- +SPL: SplFileObject::setCsvControl basic +--CREDITS-- +Erwin Poeze +--FILE-- +setFlags(SplFileObject::READ_CSV); +$s->setCsvControl('|', '\'', '/'); +foreach ($s as $row) { + list($fruit, $quantity) = $row; + echo "$fruit : $quantity\n"; +} +?> +--CLEAN-- + +--EXPECT-- +groene appelen : 10 +gele bananen : 20 +rode kersen : 30 + diff --git a/ext/spl/tests/SplFileObject_setCsvControl_error001.phpt b/ext/spl/tests/SplFileObject_setCsvControl_error001.phpt new file mode 100644 index 000000000000..f582a4a89494 --- /dev/null +++ b/ext/spl/tests/SplFileObject_setCsvControl_error001.phpt @@ -0,0 +1,24 @@ +--TEST-- +SPL: SplFileObject::setCsvControl error 001 +--CREDITS-- +Erwin Poeze +--FILE-- +setFlags(SplFileObject::READ_CSV); +$s->setCsvControl('||'); +?> +--CLEAN-- + +--EXPECTF-- +Warning: SplFileObject::setCsvControl(): delimiter must be a character in %s on line %d + diff --git a/ext/spl/tests/SplFileObject_setCsvControl_error002.phpt b/ext/spl/tests/SplFileObject_setCsvControl_error002.phpt new file mode 100644 index 000000000000..bcfd9c4dd615 --- /dev/null +++ b/ext/spl/tests/SplFileObject_setCsvControl_error002.phpt @@ -0,0 +1,24 @@ +--TEST-- +SPL: SplFileObject::setCsvControl error 002 +--CREDITS-- +Erwin Poeze +--FILE-- +setFlags(SplFileObject::READ_CSV); +$s->setCsvControl('|', 'two'); +?> +--CLEAN-- + +--EXPECTF-- +Warning: SplFileObject::setCsvControl(): enclosure must be a character in %s on line %d + diff --git a/ext/spl/tests/SplFileObject_setCsvControl_error003.phpt b/ext/spl/tests/SplFileObject_setCsvControl_error003.phpt new file mode 100644 index 000000000000..8b1f54d5a42b --- /dev/null +++ b/ext/spl/tests/SplFileObject_setCsvControl_error003.phpt @@ -0,0 +1,26 @@ +--TEST-- +SPL: SplFileObject::setCsvControl error 003 +--CREDITS-- +Erwin Poeze +--INI-- +include_path=. +--FILE-- +setFlags(SplFileObject::READ_CSV); +$s->setCsvControl('|', '\'', 'three'); +?> +--CLEAN-- + +--EXPECTF-- +Warning: SplFileObject::setCsvControl(): escape must be a character in %s on line %d + diff --git a/ext/spl/tests/SplFileObject_setCsvControl_variation001.phpt b/ext/spl/tests/SplFileObject_setCsvControl_variation001.phpt new file mode 100644 index 000000000000..7aaf8a3fe621 --- /dev/null +++ b/ext/spl/tests/SplFileObject_setCsvControl_variation001.phpt @@ -0,0 +1,30 @@ +--TEST-- +SPL: SplFileObject::setCsvControl variation 001 +--CREDITS-- +Erwin Poeze +--FILE-- +setFlags(SplFileObject::READ_CSV); +$s->setCsvControl(); +foreach ($s as $row) { + list($fruit, $quantity) = $row; + echo "$fruit : $quantity\n"; +} +?> +--CLEAN-- + +--EXPECT-- +groene appelen : 10 +gele bananen : 20 +rode kersen : 30 + diff --git a/ext/spl/tests/fileobject_getmaxlinelen_error001.phpt b/ext/spl/tests/fileobject_getmaxlinelen_error001.phpt new file mode 100644 index 000000000000..3c0c9eebd52c --- /dev/null +++ b/ext/spl/tests/fileobject_getmaxlinelen_error001.phpt @@ -0,0 +1,14 @@ +--TEST-- +SPL: SplFileObject::getMaxLineLen error 001 +--CREDITS-- +Erwin Poeze +--INI-- +include_path=. +--FILE-- +getMaxLineLen('string'); + +?> +--EXPECTF-- +Warning: SplFileObject::getMaxLineLen() expects exactly 0 parameters, 1 given in %s on line %d diff --git a/ext/spl/tests/fileobject_setmaxlinelen_error001.phpt b/ext/spl/tests/fileobject_setmaxlinelen_error001.phpt new file mode 100644 index 000000000000..6bfdfdcf5099 --- /dev/null +++ b/ext/spl/tests/fileobject_setmaxlinelen_error001.phpt @@ -0,0 +1,17 @@ +--TEST-- +SPL: SplFileObject::setMaxLineLen error 001() +--CREDITS-- +Erwin Poeze +--FILE-- +setMaxLineLen(-1); +} +catch (DomainException $e) { + echo 'DomainException thrown'; +} + +?> +--EXPECT-- +DomainException thrown diff --git a/ext/spl/tests/fileobject_setmaxlinelen_error002.phpt b/ext/spl/tests/fileobject_setmaxlinelen_error002.phpt new file mode 100644 index 000000000000..dad59fca5ff0 --- /dev/null +++ b/ext/spl/tests/fileobject_setmaxlinelen_error002.phpt @@ -0,0 +1,12 @@ +--TEST-- +SPL: SplFileObject::setMaxLineLen error 002 +--CREDITS-- +Erwin Poeze +--FILE-- +setMaxLineLen(); + +?> +--EXPECTF-- +Warning: SplFileObject::setMaxLineLen() expects exactly 1 parameter, 0 given in %s on line %d diff --git a/ext/spl/tests/fileobject_setmaxlinelen_error003.phpt b/ext/spl/tests/fileobject_setmaxlinelen_error003.phpt new file mode 100644 index 000000000000..8dc50d5fc746 --- /dev/null +++ b/ext/spl/tests/fileobject_setmaxlinelen_error003.phpt @@ -0,0 +1,12 @@ +--TEST-- +SPL: SplFileObject::setMaxLineLen error 003 +--CREDITS-- +Erwin Poeze +--FILE-- +setMaxLineLen('string'); + +?> +--EXPECTF-- +Warning: SplFileObject::setMaxLineLen() expects parameter 1 to be long, string given in %s on line %d