From abfc7d5e3419e6f317a6366b7e4c273b0465ed2e Mon Sep 17 00:00:00 2001 From: Christian Schneider Date: Thu, 26 Jun 2008 15:08:57 +0000 Subject: Replaced deprecated mysql_list_tables by SHOW TABLES Constructor of generated classes now take varargs too and added tests for it --- tests/it_dbi.t | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/it_dbi.t b/tests/it_dbi.t index 63c7413..6e14657 100755 --- a/tests/it_dbi.t +++ b/tests/it_dbi.t @@ -51,6 +51,43 @@ is( "select with multiple parameters (foo part)" ); +it_dbi::createclass(array('table' => "it_dbi_test", 'forcecreate' => true)); + +$record = new it_dbi_test; +is( + $record->x, + null, + "constructor of created class without argument" +); + +$record = new it_dbi_test(2); +is( + $record->ID, + 2, + "constructor of created class with id parameter" +); + +$record = new it_dbi_test(array('x >' => 0), "ORDER BY x DESC"); +is( + $record->x, + 64738, + "constructor of created class with multiple select parameters" +); + +$record = new it_dbi_test(array('foo' => 'bar')); +is( + $record->ID, + 2, + "constructor of created class with single array parameter" +); + +$record = new it_dbi($db + array('table' => "it_dbi_test")); +is( + $record->x, + null, + "constructor without parameters" +); + $record = new it_dbi($db + array('table' => "it_dbi_test"), array('x >' => 0), "ORDER BY x DESC"); is( $record->x, @@ -58,7 +95,6 @@ is( "constructor with multiple select parameters" ); - $record->select(array('x' => 64738)); is( array($record->_key, $record->x, $record->foo), -- cgit v1.2.3