1--TEST--
2Test sqlite_last_error() function : error conditions
3--SKIPIF--
4<?php if (!extension_loaded("sqlite")) print "skip sqlite extension not loaded"; ?>
5--FILE--
6<?php
7/* Prototype  : int sqlite_last_error(resource db)
8 * Description: Returns the error code of the last error for a database.
9 * Source code: ext/sqlite/sqlite.c
10 * Alias to functions:
11 */
12
13echo "*** Testing sqlite_last_error() : error conditions ***\n";
14
15// Zero arguments
16echo "\n-- Testing sqlite_last_error() function with Zero arguments --\n";
17var_dump( sqlite_last_error() );
18
19//Test sqlite_last_error with one more than the expected number of arguments
20echo "\n-- Testing sqlite_last_error() function with more than expected no. of arguments --\n";
21
22$db = sqlite_open(':memory:');
23$extra_arg = 10;
24var_dump( sqlite_last_error($db, $extra_arg) );
25sqlite_close($db);
26
27$db = new SQLiteDatabase(':memory:');
28var_dump( $db->lastError($extra_arg) );
29
30?>
31===DONE===
32--EXPECTF--
33*** Testing sqlite_last_error() : error conditions ***
34
35-- Testing sqlite_last_error() function with Zero arguments --
36
37Warning: sqlite_last_error() expects exactly 1 parameter, 0 given in %s on line %d
38NULL
39
40-- Testing sqlite_last_error() function with more than expected no. of arguments --
41
42Warning: sqlite_last_error() expects exactly 1 parameter, 2 given in %s on line %d
43NULL
44
45Warning: SQLiteDatabase::lastError() expects exactly 0 parameters, 1 given in %s on line %d
46NULL
47===DONE===
48