1--TEST--
2SQLite3::createAggregate() Test whether a supplied PHP function is valid when using in an aggregate function
3--CREDITS--
4James Cauwelier
5# Belgium PHP TestFest (2009)
6--EXTENSIONS--
7sqlite3
8--FILE--
9<?php
10
11function aggregate_step ($var) { return $var; }
12function aggregate_final ($var) { return $var; }
13
14$db = new SQLite3(':memory:');
15
16try {
17    $db->createAggregate('TESTAGGREGATE', 'aggregate_test_step', 'aggregate_final');
18} catch (TypeError $exception) {
19    echo $exception->getMessage() . "\n";
20}
21
22try {
23    $db->createAggregate('TESTAGGREGATE2', 'aggregate_step', 'aggregate_test_final');
24} catch (TypeError $exception) {
25    echo $exception->getMessage() . "\n";
26}
27
28var_dump($db->createAggregate ('TESTAGGREGATE3', 'aggregate_step', 'aggregate_final'));
29
30$db->close();
31
32echo "Done"
33?>
34--EXPECT--
35SQLite3::createAggregate(): Argument #2 ($stepCallback) must be a valid callback, function "aggregate_test_step" not found or invalid function name
36SQLite3::createAggregate(): Argument #3 ($finalCallback) must be a valid callback, function "aggregate_test_final" not found or invalid function name
37bool(true)
38Done
39