php-src/ext/pdo_sqlite/tests/subclasses/pdo_sqlite_createaggregate.phpt
2024-05-30 20:15:42 +02:00

28 lines
713 B
PHP

--TEST--
PDO_sqlite: Testing createAggregate()
--EXTENSIONS--
pdo_sqlite
--FILE--
<?php
// This test was copied from the pdo_sqlite test for sqliteCreateAggregate
$db = new Pdo\Sqlite('sqlite::memory:');
$db->query('CREATE TABLE test_pdo_sqlite_createaggregate (id INT AUTO INCREMENT, name TEXT)');
$db->query('INSERT INTO test_pdo_sqlite_createaggregate VALUES (NULL, "PHP"), (NULL, "PHP6")');
$db->createAggregate('testing', function(&$a, $b) { $a .= $b; return $a; }, function(&$v) { return $v; });
foreach ($db->query('SELECT testing(name) FROM test_pdo_sqlite_createaggregate') as $row) {
var_dump($row);
}
?>
--EXPECT--
array(2) {
["testing(name)"]=>
string(2) "12"
[0]=>
string(2) "12"
}