| 1 |
lars |
1 |
This is a test framework for MDB2 built using PHPUnit.
|
|
|
2 |
These tests directly access the MDB2 API - hopefully this framework
|
|
|
3 |
should give better feedback as to where or what caused when error are encountered.
|
|
|
4 |
|
|
|
5 |
Usage:
|
|
|
6 |
In order for the tests to work they need to access a database called
|
|
|
7 |
"driver_test". This database is created using the MDB2_Schema test or
|
|
|
8 |
running the import.schema.php script (edit the db DSN information).
|
|
|
9 |
If you have problems running these test or the driver you are using does not yet
|
|
|
10 |
provide the necessary methods you may create the "driver_test" database manually:
|
|
|
11 |
|
|
|
12 |
CREATE TABLE "files" (
|
|
|
13 |
"id" int(11) NOT NULL default '0',
|
|
|
14 |
"document" longtext,
|
|
|
15 |
"picture" longblob,
|
|
|
16 |
UNIQUE KEY "lob_id_index_idx" ("id")
|
|
|
17 |
);
|
|
|
18 |
|
|
|
19 |
CREATE TABLE "users" (
|
|
|
20 |
"user_name" varchar(12) default NULL,
|
|
|
21 |
"user_password" char(8) default NULL,
|
|
|
22 |
"subscribed" tinyint(1) default '1',
|
|
|
23 |
"user_id" int(11) NOT NULL default '0',
|
|
|
24 |
"quota" decimal(18,2) default '0.00',
|
|
|
25 |
"weight" double default '0',
|
|
|
26 |
"access_date" date default '1970-01-01',
|
|
|
27 |
"access_time" time default '00:00:00',
|
|
|
28 |
"approved" datetime default '1970-01-01 00:00:00',
|
|
|
29 |
UNIQUE KEY "users_id_index_idx" ("user_id")
|
|
|
30 |
);
|
|
|
31 |
|
|
|
32 |
To setup the tests
|
|
|
33 |
|
|
|
34 |
* requires PHPUnit to be installed
|
|
|
35 |
|
|
|
36 |
* requires MDB2 (with the given driver) to be installed
|
|
|
37 |
in a php include path.
|
|
|
38 |
|
|
|
39 |
* copy the file test_setup.php.dist to test_setup.php
|
|
|
40 |
|
|
|
41 |
* edit test_setup.php. The array $testarray specifies which testcases
|
|
|
42 |
to carry out. $dbarray is an array of databases to test.
|
|
|
43 |
|
|
|
44 |
* point your browser at test.php or your CLI at clitest.php for the results,
|
|
|
45 |
and then fix the bugs!
|
|
|
46 |
|
|
|
47 |
* by default test.php/clitest.php will use all tests in the testcases - if
|
|
|
48 |
you want to pick specific tests, use testchoose.php to pick just the
|
|
|
49 |
tests you want to run
|
|
|
50 |
|
|
|
51 |
Writing tests:
|
|
|
52 |
|
|
|
53 |
The tests are written using PHPUnit from pear so first make sure you
|
|
|
54 |
have the latest stable release, and have read the docs,
|
|
|
55 |
http://pear.php.net/manual/en/packages.phpunit.php
|