summaryrefslogtreecommitdiff
path: root/ext/sqlite3
diff options
context:
space:
mode:
authorFelipe Pena <felipe@php.net>2009-05-17 16:51:59 +0000
committerFelipe Pena <felipe@php.net>2009-05-17 16:51:59 +0000
commitb5cec43162890b1fc3a6286cdcc99f6be209dbbc (patch)
tree9e576f41a60fbc9aa6802f5c9555a3e86d4f5f6d /ext/sqlite3
parent6f75314b84d325ff3456b12d24b8ec2cbba73b6b (diff)
downloadphp-git-b5cec43162890b1fc3a6286cdcc99f6be209dbbc.tar.gz
- New tests (testfest BelgiumUG)
Diffstat (limited to 'ext/sqlite3')
-rw-r--r--ext/sqlite3/tests/sqlite3_02_open.phpt19
-rw-r--r--ext/sqlite3/tests/sqlite3_31_changes.phpt20
-rw-r--r--ext/sqlite3/tests/sqlite3_31_open.phpt20
-rw-r--r--ext/sqlite3/tests/sqlite3_32_changes.phpt17
-rw-r--r--ext/sqlite3/tests/sqlite3_32_createAggregate_paramCount.phpt21
-rw-r--r--ext/sqlite3/tests/sqlite3_32_last_insert_rowid_param.phpt40
-rw-r--r--ext/sqlite3/tests/sqlite3_33_createAggregate_notcallable.phpt29
-rw-r--r--ext/sqlite3/tests/sqlite3_33_load_extension_param.phpt23
-rw-r--r--ext/sqlite3/tests/sqlite3_33_reset.phpt27
-rw-r--r--ext/sqlite3/tests/sqlite3_34_load_extension_ext_dir.phpt21
-rw-r--r--ext/sqlite3/tests/sqlite3_close_error.phpt21
-rw-r--r--ext/sqlite3/tests/sqlite3_close_with_params.phpt18
-rw-r--r--ext/sqlite3/tests/sqlite3_enable_exceptions.phpt36
-rw-r--r--ext/sqlite3/tests/sqlite3_exec_wrongparams.phpt16
-rw-r--r--ext/sqlite3/tests/sqlite3_lasterrorcode_with_params.phpt18
-rw-r--r--ext/sqlite3/tests/sqlite3_lasterrormsg_with_params.phpt17
-rw-r--r--ext/sqlite3/tests/sqlite3_loadextension_with_wrong_param.phpt18
-rw-r--r--ext/sqlite3/tests/sqlite3_open_empty_string.phpt17
-rw-r--r--ext/sqlite3/tests/sqlite3_openblob_wrongparams.phpt79
-rw-r--r--ext/sqlite3/tests/sqlite3_prepare_faultystmt.phpt20
-rw-r--r--ext/sqlite3/tests/sqlite3_prepare_with_empty_string.phpt16
-rw-r--r--ext/sqlite3/tests/sqlite3_prepare_wrongparams.phpt19
-rw-r--r--ext/sqlite3/tests/sqlite3_prepared_stmt_clear_with_params.phpt34
-rw-r--r--ext/sqlite3/tests/sqlite3_query_error.phpt32
-rw-r--r--ext/sqlite3/tests/sqlite3_querysingle_error.phpt31
-rw-r--r--ext/sqlite3/tests/sqlite3_version_noparam.phpt16
-rw-r--r--ext/sqlite3/tests/sqlite3result_fetcharray_with_two_params_fails.phpt20
-rw-r--r--ext/sqlite3/tests/sqlite3result_numcolumns_error.phpt33
-rw-r--r--ext/sqlite3/tests/sqlite3result_reset_with_params_fails.phpt19
-rw-r--r--ext/sqlite3/tests/sqlite3stmt_reset_params.phpt47
30 files changed, 764 insertions, 0 deletions
diff --git a/ext/sqlite3/tests/sqlite3_02_open.phpt b/ext/sqlite3/tests/sqlite3_02_open.phpt
new file mode 100644
index 0000000000..f9155e7d79
--- /dev/null
+++ b/ext/sqlite3/tests/sqlite3_02_open.phpt
@@ -0,0 +1,19 @@
+--TEST--
+SQLite3::open test, testing for function parameters
+--CREDITS--
+Felix De Vliegher
+# Belgian PHP Testfest 2009
+--SKIPIF--
+<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
+--FILE--
+<?php
+
+try {
+ $db = new SQLite3();
+} catch (Exception $e) {
+ var_dump($e->getMessage());
+}
+
+?>
+--EXPECTF--
+%string|unicode%(60) "SQLite3::__construct() expects at least 1 parameter, 0 given"
diff --git a/ext/sqlite3/tests/sqlite3_31_changes.phpt b/ext/sqlite3/tests/sqlite3_31_changes.phpt
new file mode 100644
index 0000000000..1667b3484a
--- /dev/null
+++ b/ext/sqlite3/tests/sqlite3_31_changes.phpt
@@ -0,0 +1,20 @@
+--TEST--
+SQLite3::changes (parameters) tests
+--CREDITS--
+Ward Hus
+#@PHP TESTFEST 2009 (BELGIUM)
+--SKIPIF--
+<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
+--FILE--
+<?php
+$db = new SQLite3(':memory:');
+var_dump($db);
+var_dump($db->changes());
+echo "Done\n";
+?>
+--EXPECTF--
+object(SQLite3)#1 (0) {
+}
+int(0)
+Done
+
diff --git a/ext/sqlite3/tests/sqlite3_31_open.phpt b/ext/sqlite3/tests/sqlite3_31_open.phpt
new file mode 100644
index 0000000000..3d93ca48fb
--- /dev/null
+++ b/ext/sqlite3/tests/sqlite3_31_open.phpt
@@ -0,0 +1,20 @@
+--TEST--
+SQLite3::re-initialize object tests
+--CREDITS--
+Jelle Lampaert
+#Belgian Testfest 2009
+--SKIPIF--
+<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
+--FILE--
+<?php
+
+try {
+ $db = new SQLite3('db1.db');
+ $db->open('db1.db');
+} catch (Exception $ex) {
+ var_dump($ex->getMessage());
+}
+
+?>
+--EXPECTF--
+%string|unicode%(29) "Already initialised DB Object"
diff --git a/ext/sqlite3/tests/sqlite3_32_changes.phpt b/ext/sqlite3/tests/sqlite3_32_changes.phpt
new file mode 100644
index 0000000000..0aad451270
--- /dev/null
+++ b/ext/sqlite3/tests/sqlite3_32_changes.phpt
@@ -0,0 +1,17 @@
+--TEST--
+SQLite3::changes empty str tests
+--CREDITS--
+Ward Hus
+#@ PHP TESTFEST 2009 (BELGIUM)
+--SKIPIF--
+<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
+--FILE--
+<?php
+$db = new SQLite3(':memory:');
+//$db = new SQLite3('mysqlitedb.db');
+$db->exec('CREATE TABLE pageView(id INTEGER PRIMARY KEY, page CHAR(256), access INTEGER(10))');
+$db->exec('INSERT INTO pageView (page, access) VALUES (\'test\', \'000000\')');
+echo $db->changes("dummy");
+?>
+--EXPECTF--
+Warning: SQLite3::changes() expects exactly 0 parameters, 1 given in %s on line %d
diff --git a/ext/sqlite3/tests/sqlite3_32_createAggregate_paramCount.phpt b/ext/sqlite3/tests/sqlite3_32_createAggregate_paramCount.phpt
new file mode 100644
index 0000000000..47139cd7dc
--- /dev/null
+++ b/ext/sqlite3/tests/sqlite3_32_createAggregate_paramCount.phpt
@@ -0,0 +1,21 @@
+--TEST--
+SQLite3::createAggregate Test that an error is thrown when no parameters are present
+--CREDIT--
+James Cauwelier
+# Belgium PHP TestFest
+--SKIPIF--
+<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
+--FILE--
+<?php
+
+$db = new SQLite3(':memory:');
+
+$db->createAggregate ();
+
+$db->close();
+
+echo "Done"
+?>
+--EXPECTF--
+Warning: SQLite3::createAggregate() expects at least 3 parameters, 0 given in %s on line %d
+Done
diff --git a/ext/sqlite3/tests/sqlite3_32_last_insert_rowid_param.phpt b/ext/sqlite3/tests/sqlite3_32_last_insert_rowid_param.phpt
new file mode 100644
index 0000000000..c696ef9dfc
--- /dev/null
+++ b/ext/sqlite3/tests/sqlite3_32_last_insert_rowid_param.phpt
@@ -0,0 +1,40 @@
+--TEST--
+SQLite3::lastInsertRowID parameter test
+--CREDITS--
+Jelle Lampaert
+#Belgian Testfest 2009
+--SKIPIF--
+<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
+--FILE--
+<?php
+
+$db = new SQLite3(':memory:');
+
+echo "Creating Table\n";
+var_dump($db->exec('CREATE TABLE test (time INTEGER, id STRING)'));
+
+echo "Inserting data\n";
+var_dump($db->exec('INSERT INTO test (time, id) VALUES(2, 1)'));
+
+echo "Request last inserted id\n";
+try {
+ $db->lastInsertRowID("");
+} catch (Exception $ex) {
+ var_dump($ex->getMessage());
+}
+
+echo "Closing database\n";
+var_dump($db->close());
+echo "Done";
+?>
+--EXPECTF--
+Creating Table
+bool(true)
+Inserting data
+bool(true)
+Request last inserted id
+
+Warning: SQLite3::lastInsertRowID() expects exactly 0 parameters, %d given in %s on line %d
+Closing database
+bool(true)
+Done
diff --git a/ext/sqlite3/tests/sqlite3_33_createAggregate_notcallable.phpt b/ext/sqlite3/tests/sqlite3_33_createAggregate_notcallable.phpt
new file mode 100644
index 0000000000..137b969770
--- /dev/null
+++ b/ext/sqlite3/tests/sqlite3_33_createAggregate_notcallable.phpt
@@ -0,0 +1,29 @@
+--TEST--
+SQLite3::createAggregate() Test whether a supplied PHP function is valid when using in an aggregate function
+--CREDIT--
+James Cauwelier
+# Belgium PHP TestFest (2009)
+--SKIPIF--
+<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
+--FILE--
+<?php
+
+function aggregate_step ($var) { return $var; }
+function aggregate_final ($var) { return $var; }
+
+$db = new SQLite3(':memory:');
+
+$db->createAggregate ('TESTAGGREGATE', 'aggregate_test_step', 'aggregate_final');
+$db->createAggregate ('TESTAGGREGATE2', 'aggregate_step', 'aggregate_test_final');
+var_dump($db->createAggregate ('TESTAGGREGATE3', 'aggregate_step', 'aggregate_final'));
+
+$db->close();
+
+echo "Done"
+?>
+--EXPECTF--
+Warning: SQLite3::createAggregate(): Not a valid callback function aggregate_test_step in %s on line %d
+
+Warning: SQLite3::createAggregate(): Not a valid callback function aggregate_test_final in %s on line %d
+bool(true)
+Done
diff --git a/ext/sqlite3/tests/sqlite3_33_load_extension_param.phpt b/ext/sqlite3/tests/sqlite3_33_load_extension_param.phpt
new file mode 100644
index 0000000000..b7b418c47c
--- /dev/null
+++ b/ext/sqlite3/tests/sqlite3_33_load_extension_param.phpt
@@ -0,0 +1,23 @@
+--TEST--
+SQLite3::loadExtension with empty extension test
+--CREDITS--
+Jelle Lampaert
+#Belgian Testfest 2009
+--INI--
+sqlite3.extension_dir=/tmp
+--SKIPIF--
+<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
+--FILE--
+<?php
+
+$db = new SQLite3(':memory:');
+
+try {
+ $db->loadExtension("");
+} catch (Extension $ex) {
+ var_dump($ex->getMessage());
+}
+
+?>
+--EXPECTF--
+Warning: SQLite3::loadExtension(): Empty string as an extension in %s on line %d
diff --git a/ext/sqlite3/tests/sqlite3_33_reset.phpt b/ext/sqlite3/tests/sqlite3_33_reset.phpt
new file mode 100644
index 0000000000..5f513fb681
--- /dev/null
+++ b/ext/sqlite3/tests/sqlite3_33_reset.phpt
@@ -0,0 +1,27 @@
+--TEST--
+SQLite3:: reset
+--CREDITS--
+Ward Hus & James Cauwelier
+#@ PHP TESTFEST 2009 (BELGIUM)
+--SKIPIF--
+<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
+--FILE--
+<?php
+
+$db = new SQLite3(':memory:');
+
+$db->exec('CREATE TABLE foo (id INTEGER, bar STRING)');
+$db->exec("INSERT INTO foo (id, bar) VALUES (1, 'This is a test')");
+
+$stmt = $db->prepare('SELECT bar FROM foo WHERE id=:id');
+$stmt->bindValue(':id', 1, SQLITE3_INTEGER);
+$stmt->reset("dummy");
+$stmt->reset();
+
+//var_dump($db);
+//var_dump($db->close());
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: SQLite3Stmt::reset() expects exactly 0 parameters, 1 given in %s on line %d
+Done
diff --git a/ext/sqlite3/tests/sqlite3_34_load_extension_ext_dir.phpt b/ext/sqlite3/tests/sqlite3_34_load_extension_ext_dir.phpt
new file mode 100644
index 0000000000..1d2721bd37
--- /dev/null
+++ b/ext/sqlite3/tests/sqlite3_34_load_extension_ext_dir.phpt
@@ -0,0 +1,21 @@
+--TEST--
+SQLite3::loadExtension with disabled extensions
+--CREDITS--
+Jelle Lampaert
+#Belgian Testfest 2009
+--SKIPIF--
+<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
+--FILE--
+<?php
+
+$db = new SQLite3(':memory:');
+
+try {
+ $db->loadExtension("");
+} catch (Extension $ex) {
+ var_dump($ex->getMessage());
+}
+
+?>
+--EXPECTF--
+Warning: SQLite3::loadExtension(): SQLite Extension are disabled in %s on line %d
diff --git a/ext/sqlite3/tests/sqlite3_close_error.phpt b/ext/sqlite3/tests/sqlite3_close_error.phpt
new file mode 100644
index 0000000000..d242352872
--- /dev/null
+++ b/ext/sqlite3/tests/sqlite3_close_error.phpt
@@ -0,0 +1,21 @@
+--TEST--
+SQLite3::close parameters
+--CREDITS--
+Jachim Coudenys
+# TestFest 2009 Belgium
+--SKIPIF--
+<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
+--FILE--
+<?php
+
+$db = new SQLite3(':memory:');
+echo 'Testing SQLite3 close with one parameter' . PHP_EOL;
+$db->close('parameter');
+
+echo "Done";
+?>
+--EXPECTF--
+Testing SQLite3 close with one parameter
+
+Warning: SQLite3::close() expects exactly 0 parameters, 1 given in %s on line %d
+Done
diff --git a/ext/sqlite3/tests/sqlite3_close_with_params.phpt b/ext/sqlite3/tests/sqlite3_close_with_params.phpt
new file mode 100644
index 0000000000..98e0483ea1
--- /dev/null
+++ b/ext/sqlite3/tests/sqlite3_close_with_params.phpt
@@ -0,0 +1,18 @@
+--TEST--
+SQLite3::close test with parameters
+--CREDITS--
+Thijs Feryn <thijs@feryn.eu>
+#TestFest PHPBelgium 2009
+--SKIPIF--
+<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
+--FILE--
+<?php
+
+$db = new SQLite3(':memory:');
+var_dump($db->close('invalid argument'));
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: SQLite3::close() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+Done
diff --git a/ext/sqlite3/tests/sqlite3_enable_exceptions.phpt b/ext/sqlite3/tests/sqlite3_enable_exceptions.phpt
new file mode 100644
index 0000000000..5090dde76c
--- /dev/null
+++ b/ext/sqlite3/tests/sqlite3_enable_exceptions.phpt
@@ -0,0 +1,36 @@
+--TEST--
+SQLite3::enableExceptions test
+--CREDITS--
+Thijs Feryn <thijs@feryn.eu>
+#TestFest PHPBelgium 2009
+--SKIPIF--
+<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
+--FILE--
+<?php
+
+$db = new SQLite3(':memory:');
+var_dump($db->enableExceptions(true));
+try{
+ $db->query("SELECT * FROM non_existent_table");
+} catch(Exception $e) {
+ echo $e->getMessage().PHP_EOL;
+}
+var_dump($db->enableExceptions(false));
+$db->query("SELECT * FROM non_existent_table");
+var_dump($db->enableExceptions("wrong_type","wrong_type"));
+echo "Closing database\n";
+var_dump($db->close());
+echo "Done\n";
+?>
+--EXPECTF--
+NULL
+no such table: non_existent_table
+NULL
+
+Warning: SQLite3::query(): no such table: non_existent_table in %s on line %d
+
+Warning: SQLite3::enableExceptions() expects at most 1 parameter, 2 given in %s on line %d
+NULL
+Closing database
+bool(true)
+Done
diff --git a/ext/sqlite3/tests/sqlite3_exec_wrongparams.phpt b/ext/sqlite3/tests/sqlite3_exec_wrongparams.phpt
new file mode 100644
index 0000000000..c94b521dce
--- /dev/null
+++ b/ext/sqlite3/tests/sqlite3_exec_wrongparams.phpt
@@ -0,0 +1,16 @@
+--TEST--
+SQLite3::exec test, testing for wrong type parameters
+--CREDITS--
+Michelangelo van Dam
+# Belgian PHP Testfest 2009
+--SKIPIF--
+<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
+--FILE--
+<?php
+
+$db = new SQLite3(':memory:');
+$db->exec(array ('a','b','c'), 20090509);
+
+?>
+--EXPECTF--
+Warning: SQLite3::exec() expects exactly 1 parameter, 2 given in %s on line %d
diff --git a/ext/sqlite3/tests/sqlite3_lasterrorcode_with_params.phpt b/ext/sqlite3/tests/sqlite3_lasterrorcode_with_params.phpt
new file mode 100644
index 0000000000..243392b318
--- /dev/null
+++ b/ext/sqlite3/tests/sqlite3_lasterrorcode_with_params.phpt
@@ -0,0 +1,18 @@
+--TEST--
+SQLite3::lastErrorCode test with parameters
+--CREDITS--
+Thijs Feryn <thijs@feryn.eu>
+#TestFest PHPBelgium 2009
+--SKIPIF--
+<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
+--FILE--
+<?php
+
+$db = new SQLite3(':memory:');
+var_dump($db->lastErrorCode('invalid argument'));
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: SQLite3::lastErrorCode() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+Done
diff --git a/ext/sqlite3/tests/sqlite3_lasterrormsg_with_params.phpt b/ext/sqlite3/tests/sqlite3_lasterrormsg_with_params.phpt
new file mode 100644
index 0000000000..c2fa35d954
--- /dev/null
+++ b/ext/sqlite3/tests/sqlite3_lasterrormsg_with_params.phpt
@@ -0,0 +1,17 @@
+--TEST--
+SQLite3::lastErrorMsg test with parameters
+--CREDITS--
+Thijs Feryn <thijs@feryn.eu>
+#TestFest PHPBelgium 2009
+--SKIPIF--
+<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
+--FILE--
+<?php
+$db = new SQLite3(':memory:');
+var_dump($db->lastErrorMsg('invalid argument'));
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: SQLite3::lastErrorMsg() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+Done
diff --git a/ext/sqlite3/tests/sqlite3_loadextension_with_wrong_param.phpt b/ext/sqlite3/tests/sqlite3_loadextension_with_wrong_param.phpt
new file mode 100644
index 0000000000..9811f86e6a
--- /dev/null
+++ b/ext/sqlite3/tests/sqlite3_loadextension_with_wrong_param.phpt
@@ -0,0 +1,18 @@
+--TEST--
+SQLite3::loadExtension test with wrong parameter type
+--CREDITS--
+Thijs Feryn <thijs@feryn.eu>
+#TestFest PHPBelgium 2009
+--SKIPIF--
+<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
+--FILE--
+<?php
+$db = new SQLite3(':memory:');
+var_dump($db->loadExtension(array()));
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: SQLite3::loadExtension() expects parameter 1 to be %binary_string_optional%, array given in %s on line %d
+NULL
+Done
+
diff --git a/ext/sqlite3/tests/sqlite3_open_empty_string.phpt b/ext/sqlite3/tests/sqlite3_open_empty_string.phpt
new file mode 100644
index 0000000000..753410cbf3
--- /dev/null
+++ b/ext/sqlite3/tests/sqlite3_open_empty_string.phpt
@@ -0,0 +1,17 @@
+--TEST--
+SQLite3::open test with empty string argument via the constructor
+--CREDITS--
+Thijs Feryn <thijs@feryn.eu>
+#TestFest PHPBelgium 2009
+--FILE--
+<?php
+try{
+ $db = new SQLite3('');
+} catch(Exception $e) {
+ echo $e->getMessage().PHP_EOL;
+}
+echo "Done\n";
+?>
+--EXPECTF--
+Unable to expand filepath
+Done
diff --git a/ext/sqlite3/tests/sqlite3_openblob_wrongparams.phpt b/ext/sqlite3/tests/sqlite3_openblob_wrongparams.phpt
new file mode 100644
index 0000000000..439e397787
--- /dev/null
+++ b/ext/sqlite3/tests/sqlite3_openblob_wrongparams.phpt
@@ -0,0 +1,79 @@
+--TEST--
+SQLite3::blobOpen test, testing stream with wrong parameter count
+--CREDITS--
+Michelangelo van Dam
+# Belgian PHP Testfest 2009
+--SKIPIF--
+<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
+--FILE--
+<?php
+class SQLite3_Test_Stream
+{
+ private $position;
+ public static $string_length = 10;
+ public static $string = "abcdefg\0hi";
+
+ public function stream_open($path, $mode, $options, &$opened_path)
+ {
+ $this->position = 0;
+ return true;
+ }
+
+ public function stream_read($count)
+ {
+ $ret = substr(self::$string, $this->position, $count);
+ $this->position += strlen($ret);
+ return $ret;
+ }
+
+ public function stream_write($data)
+ {
+ return 0;
+ }
+
+ public function stream_stat()
+ {
+ return array('size' => self::$string_length);
+ }
+
+ public function stream_tell()
+ {
+ return $this->position;
+ }
+
+ public function stream_eof()
+ {
+ return ($this->position >= self::$string_length);
+ }
+}
+
+$db = new SQLite3(':memory:');
+stream_wrapper_register('sqliteBlobTest', "SQLite3_Test_Stream") or die("Unable to register sqliteBlobTest stream");
+echo "Creating table: " . var_export($db->exec('CREATE TABLE test (id STRING, data BLOB)'),true) . "\n";
+
+echo "PREPARING insert\n";
+$insert_stmt = $db->prepare("INSERT INTO test (id, data) VALUES (?, ?)");
+
+echo "BINDING Parameters:\n";
+var_dump($insert_stmt->bindValue(1, 'a', SQLITE3_TEXT));
+var_dump($insert_stmt->bindValue(2, 'TEST TEST', SQLITE3_BLOB));
+$insert_stmt->execute();
+echo "Closing statement: " . var_export($insert_stmt->close(), true) . "\n";
+
+echo "Open BLOB with wrong parameter count\n";
+$stream = $db->openBlob();
+var_dump($stream);
+echo "Done\n";
+?>
+--EXPECTF--
+Creating table: true
+PREPARING insert
+BINDING Parameters:
+bool(true)
+bool(true)
+Closing statement: true
+Open BLOB with wrong parameter count
+
+Warning: SQLite3::openBlob() expects at least 3 parameters, 0 given in %s on line %d
+NULL
+Done
diff --git a/ext/sqlite3/tests/sqlite3_prepare_faultystmt.phpt b/ext/sqlite3/tests/sqlite3_prepare_faultystmt.phpt
new file mode 100644
index 0000000000..5cdf322a96
--- /dev/null
+++ b/ext/sqlite3/tests/sqlite3_prepare_faultystmt.phpt
@@ -0,0 +1,20 @@
+--TEST--
+SQLite3::prepare test, testing for faulty statement
+--CREDITS--
+Michelangelo van Dam
+# Belgian PHP Testfest 2009
+--SKIPIF--
+<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
+--FILE--
+<?php
+$db = new SQLite3(':memory:');
+$db->exec('CREATE TABLE foo (id INTEGER, bar STRING)');
+$db->exec("INSERT INTO foo (id, bar) VALUES (1, 'This is a test')");
+
+$stmt = $db->prepare('SELECT foo FROM bar');
+
+var_dump($stmt);
+?>
+--EXPECTF--
+Warning: SQLite3::prepare(): Unable to prepare statement: 1, no such table: bar in %s on line %d
+bool(false)
diff --git a/ext/sqlite3/tests/sqlite3_prepare_with_empty_string.phpt b/ext/sqlite3/tests/sqlite3_prepare_with_empty_string.phpt
new file mode 100644
index 0000000000..dea7d91226
--- /dev/null
+++ b/ext/sqlite3/tests/sqlite3_prepare_with_empty_string.phpt
@@ -0,0 +1,16 @@
+--TEST--
+SQLite3::prepare test with empty string argument
+--CREDITS--
+Thijs Feryn <thijs@feryn.eu>
+#TestFest PHPBelgium 2009
+--SKIPIF--
+<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
+--FILE--
+<?php
+$db = new SQLite3(':memory:');
+var_dump($db->prepare(''));
+echo "Done\n";
+?>
+--EXPECTF--
+bool(false)
+Done
diff --git a/ext/sqlite3/tests/sqlite3_prepare_wrongparams.phpt b/ext/sqlite3/tests/sqlite3_prepare_wrongparams.phpt
new file mode 100644
index 0000000000..b7eb564e19
--- /dev/null
+++ b/ext/sqlite3/tests/sqlite3_prepare_wrongparams.phpt
@@ -0,0 +1,19 @@
+--TEST--
+SQLite3::prepare test, testing for wrong parameters
+--CREDITS--
+Michelangelo van Dam
+# Belgian PHP Testfest 2009
+--SKIPIF--
+<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
+--FILE--
+<?php
+
+$db = new SQLite3(':memory:');
+$db->exec('CREATE TABLE foo (id INTEGER, bar STRING)');
+$db->exec("INSERT INTO foo (id, bar) VALUES (1, 'This is a test')");
+
+$stmt = $db->prepare();
+
+?>
+--EXPECTF--
+Warning: SQLite3::prepare() expects exactly 1 parameter, 0 given in %s on line %d
diff --git a/ext/sqlite3/tests/sqlite3_prepared_stmt_clear_with_params.phpt b/ext/sqlite3/tests/sqlite3_prepared_stmt_clear_with_params.phpt
new file mode 100644
index 0000000000..d04fb66e56
--- /dev/null
+++ b/ext/sqlite3/tests/sqlite3_prepared_stmt_clear_with_params.phpt
@@ -0,0 +1,34 @@
+--TEST--
+SQLite3Stmt::clear test with parameters
+--CREDITS--
+Thijs Feryn <thijs@feryn.eu>
+#TestFest PHPBelgium 2009
+--SKIPIF--
+<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
+--FILE--
+<?php
+$db = new SQLite3(':memory:');
+define('TIMENOW', time());
+echo "Creating Table\n";
+$db->exec('CREATE TABLE test (time INTEGER, id STRING)');
+echo "INSERT into table\n";
+var_dump($db->exec("INSERT INTO test (time, id) VALUES (" . TIMENOW . ", 'b')"));
+
+echo "SELECTING results\n";
+$stmt = $db->prepare("SELECT * FROM test WHERE id = ? ORDER BY id ASC");
+var_dump($stmt->clear('invalid argument'));
+echo "Closing database\n";
+var_dump($db->close());
+echo "Done\n";
+?>
+--EXPECTF--
+Creating Table
+INSERT into table
+bool(true)
+SELECTING results
+
+Warning: SQLite3Stmt::clear() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+Closing database
+bool(true)
+Done
diff --git a/ext/sqlite3/tests/sqlite3_query_error.phpt b/ext/sqlite3/tests/sqlite3_query_error.phpt
new file mode 100644
index 0000000000..ab7f700d92
--- /dev/null
+++ b/ext/sqlite3/tests/sqlite3_query_error.phpt
@@ -0,0 +1,32 @@
+--TEST--
+SQLite3::query parameters
+--CREDITS--
+Jachim Coudenys
+# TestFest 2009 Belgium
+--SKIPIF--
+<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
+--FILE--
+<?php
+
+$db = new SQLite3(':memory:');
+echo 'Testing SQLite3 query without parameters' . PHP_EOL;
+$db->query();
+
+echo 'Testing SQLite3 query with one array parameter' . PHP_EOL;
+$db->query(array());
+
+echo 'Testing SQLite3 qeury with empty string parameter' . PHP_EOL;
+var_dump($db->query(''));
+
+echo "Done";
+?>
+--EXPECTF--
+Testing SQLite3 query without parameters
+
+Warning: SQLite3::query() expects exactly 1 parameter, 0 given in %s on line %d
+Testing SQLite3 query with one array parameter
+
+Warning: SQLite3::query() expects parameter 1 to be %binary_string_optional%, array given in %s on line %d
+Testing SQLite3 qeury with empty string parameter
+bool(false)
+Done
diff --git a/ext/sqlite3/tests/sqlite3_querysingle_error.phpt b/ext/sqlite3/tests/sqlite3_querysingle_error.phpt
new file mode 100644
index 0000000000..85889c755a
--- /dev/null
+++ b/ext/sqlite3/tests/sqlite3_querysingle_error.phpt
@@ -0,0 +1,31 @@
+--TEST--
+SQLite3::query parameters
+--CREDITS--
+Jachim Coudenys
+# TestFest 2009 Belgium
+--SKIPIF--
+<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
+--FILE--
+<?php
+$db = new SQLite3(':memory:');
+echo 'Testing SQLite3 querySingle without parameters' . PHP_EOL;
+$db->querySingle();
+
+echo 'Testing SQLite3 querySingle with one array parameter' . PHP_EOL;
+$db->querySingle(array());
+
+echo 'Testing SQLite3 qeurySingle with empty string parameter' . PHP_EOL;
+var_dump($db->querySingle(''));
+
+echo "Done";
+?>
+--EXPECTF--
+Testing SQLite3 querySingle without parameters
+
+Warning: SQLite3::querySingle() expects at least 1 parameter, 0 given in %s on line %d
+Testing SQLite3 querySingle with one array parameter
+
+Warning: SQLite3::querySingle() expects parameter 1 to be %binary_string_optional%, array given in %s on line %d
+Testing SQLite3 qeurySingle with empty string parameter
+bool(false)
+Done
diff --git a/ext/sqlite3/tests/sqlite3_version_noparam.phpt b/ext/sqlite3/tests/sqlite3_version_noparam.phpt
new file mode 100644
index 0000000000..19d6ec5a33
--- /dev/null
+++ b/ext/sqlite3/tests/sqlite3_version_noparam.phpt
@@ -0,0 +1,16 @@
+--TEST--
+SQLite3::version test, testing for missing function parameters
+--CREDITS--
+Michelangelo van Dam
+# Belgian PHP Testfest 2009
+--SKIPIF--
+<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
+--FILE--
+<?php
+
+var_dump(SQLite3::version('dummy'));
+
+?>
+--EXPECTF--
+Warning: SQLite3::version() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
diff --git a/ext/sqlite3/tests/sqlite3result_fetcharray_with_two_params_fails.phpt b/ext/sqlite3/tests/sqlite3result_fetcharray_with_two_params_fails.phpt
new file mode 100644
index 0000000000..cb49b75539
--- /dev/null
+++ b/ext/sqlite3/tests/sqlite3result_fetcharray_with_two_params_fails.phpt
@@ -0,0 +1,20 @@
+--TEST--
+SQLite3Result::fetchArray() test, testing two params causes a failure
+--CREDITS--
+Michelangelo van Dam
+# Belgian PHP Testfest 2009
+--SKIPIF--
+<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
+--FILE--
+<?php
+$db = new SQLite3(':memory:');
+$db->exec('CREATE TABLE foo (bar STRING)');
+$db->exec("INSERT INTO foo (bar) VALUES ('This is a test')");
+$db->exec("INSERT INTO foo (bar) VALUES ('This is another test')");
+
+$result = $db->query('SELECT bar FROM foo');
+var_dump($result->fetchArray(1,2));
+?>
+--EXPECTF--
+Warning: SQLite3Result::fetchArray() expects at most 1 parameter, 2 given in %s on line %d
+NULL
diff --git a/ext/sqlite3/tests/sqlite3result_numcolumns_error.phpt b/ext/sqlite3/tests/sqlite3result_numcolumns_error.phpt
new file mode 100644
index 0000000000..5f8306cb2d
--- /dev/null
+++ b/ext/sqlite3/tests/sqlite3result_numcolumns_error.phpt
@@ -0,0 +1,33 @@
+--TEST--
+SQLite3Result::numColumns parameters
+--CREDITS--
+Jachim Coudenys
+# TestFest 2009 Belgium
+--SKIPIF--
+<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
+--FILE--
+<?php
+$db = new SQLite3(':memory:');
+echo 'Creating Table' . PHP_EOL;
+var_dump($db->exec('CREATE TABLE test (time INTEGER, id STRING)'));
+
+echo 'Inserting data' . PHP_EOL;
+var_dump($db->exec('INSERT INTO test (time, id) VALUES(2, 1)'));
+
+echo 'Fetching number of columns' . PHP_EOL;
+$result = $db->query('SELECT id FROM test');
+var_dump($result->numColumns('time'));
+
+echo 'Done';
+
+?>
+--EXPECTF--
+Creating Table
+bool(true)
+Inserting data
+bool(true)
+Fetching number of columns
+
+Warning: SQLite3Result::numColumns() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
+Done
diff --git a/ext/sqlite3/tests/sqlite3result_reset_with_params_fails.phpt b/ext/sqlite3/tests/sqlite3result_reset_with_params_fails.phpt
new file mode 100644
index 0000000000..b397ac6730
--- /dev/null
+++ b/ext/sqlite3/tests/sqlite3result_reset_with_params_fails.phpt
@@ -0,0 +1,19 @@
+--TEST--
+SQLite3Result::reset test, testing an exception is raised when calling reset with parameters
+--CREDITS--
+Michelangelo van Dam
+# Belgian PHP Testfest 2009
+--SKIPIF--
+<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
+--FILE--
+<?php
+$db = new SQLite3(':memory:');
+$db->exec('CREATE TABLE foo (bar STRING)');
+$db->exec("INSERT INTO foo (bar) VALUES ('This is a test')");
+$db->exec("INSERT INTO foo (bar) VALUES ('This is another test')");
+
+$result = $db->query('SELECT bar FROM foo');
+$result->reset(1);
+?>
+--EXPECTF--
+Warning: SQLite3Result::reset() expects exactly 0 parameters, 1 given in %s on line %d
diff --git a/ext/sqlite3/tests/sqlite3stmt_reset_params.phpt b/ext/sqlite3/tests/sqlite3stmt_reset_params.phpt
new file mode 100644
index 0000000000..b0dfc20456
--- /dev/null
+++ b/ext/sqlite3/tests/sqlite3stmt_reset_params.phpt
@@ -0,0 +1,47 @@
+--TEST--
+SQLite3Stmt::reset with parameter test
+--CREDITS--
+Jelle Lampaert
+#Belgian Testfest 2009
+--SKIPIF--
+<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
+--FILE--
+<?php
+$db = new SQLite3(':memory:');
+echo "Creating Table\n";
+var_dump($db->exec('CREATE TABLE foobar (id INTEGER, name STRING)'));
+
+echo "INSERT into table\n";
+var_dump($db->exec("INSERT INTO foobar (id, name) VALUES (1, 'john')"));
+
+
+$query = "SELECT name FROM foobar WHERE id = 1";
+
+echo "Prepare query\n";
+$stmt = $db->prepare($query);
+
+echo "Reset query\n";
+try {
+ $stmt->reset("foo");
+} catch (Exception $ex) {
+ var_dump($ex->getMessage());
+}
+
+echo "Closing database\n";
+$stmt = null;
+$result = null;
+var_dump($db->close());
+echo "Done\n";
+?>
+--EXPECTF--
+Creating Table
+bool(true)
+INSERT into table
+bool(true)
+Prepare query
+Reset query
+
+Warning: SQLite3Stmt::reset() expects exactly 0 parameters, %d given in %s on line %d
+Closing database
+bool(true)
+Done