tests
[m6w6/pq-gateway] / tests / setup.inc
1 <?php
2
3 define("PQ_DSN", "");
4 define("PQ_TEST_TABLE_NAME", "test");
5 define("PQ_TEST_CREATE_TABLE", sprintf(
6 <<<SQL
7 create table %s (
8 id serial primary key,
9 created timestamp,
10 counter int,
11 number decimal,
12 data text
13 )
14 SQL
15 , PQ_TEST_TABLE_NAME));
16 define("PQ_TEST_DROP_TABLE", sprintf("drop table if exists %s", PQ_TEST_TABLE_NAME));
17 define("PQ_TEST_CREATE_DATA", sprintf(
18 <<<SQL
19 insert into %1\$s values (default, 'yesterday', -1, -1.1, 'yesterday');
20 insert into %1\$s values (default, 'today', 0, 0, 'today');
21 insert into %1\$s values (default, 'tomorrow', 1, 1.1, 'tomorrow');
22 SQL
23 , PQ_TEST_TABLE_NAME
24 ));
25
26 spl_autoload_register(function($c) {
27 if (substr($c,0,3) == "pq\\") return require_once sprintf("%s/../lib/%s.php", __DIR__, strtr($c, "\\", "/"));
28 });