From 11ee3cf9addd85f5ff40f8dff559cb9c6e2afbf1 Mon Sep 17 00:00:00 2001 From: dbrewer Date: Thu, 8 Nov 2007 21:44:11 +0000 Subject: [PATCH] Added test case for #587, and models to support that test case. --- models/Bookmark.php | 9 + models/BookmarkUser.php | 14 + models/Page.php | 17 ++ tests/Ticket/587TestCase.php | 106 +++++++ tests/run.php | 517 ++++++++++++++++++----------------- 5 files changed, 405 insertions(+), 258 deletions(-) create mode 100644 models/Bookmark.php create mode 100644 models/BookmarkUser.php create mode 100644 models/Page.php create mode 100644 tests/Ticket/587TestCase.php diff --git a/models/Bookmark.php b/models/Bookmark.php new file mode 100644 index 000000000..a4e6437e4 --- /dev/null +++ b/models/Bookmark.php @@ -0,0 +1,9 @@ +hasColumn('user_id', 'integer', null, array('primary' => true)); + $this->hasColumn('page_id', 'integer', null, array('primary' => true)); + } +} diff --git a/models/BookmarkUser.php b/models/BookmarkUser.php new file mode 100644 index 000000000..7759a3e18 --- /dev/null +++ b/models/BookmarkUser.php @@ -0,0 +1,14 @@ +hasMany('Bookmark as Bookmarks', + array('local' => 'id', + 'foreign' => 'user_id')); + } + public function setTableDefinition() + { + $this->hasColumn('name', 'string', 30); + } +} diff --git a/models/Page.php b/models/Page.php new file mode 100644 index 000000000..02f00fc42 --- /dev/null +++ b/models/Page.php @@ -0,0 +1,17 @@ +hasMany('Bookmark as Bookmarks', + array('local' => 'id', + 'foreign' => 'page_id')); + } + + public function setTableDefinition() + { + $this->hasColumn('name', 'string', 30); + $this->hasColumn('url', 'string', 100); + } +} diff --git a/tests/Ticket/587TestCase.php b/tests/Ticket/587TestCase.php new file mode 100644 index 000000000..cf24af59e --- /dev/null +++ b/tests/Ticket/587TestCase.php @@ -0,0 +1,106 @@ + + * @license http://www.opensource.org/licenses/lgpl-license.php LGPL + * @category Object Relational Mapping + * @link www.phpdoctrine.com + * @since 1.0 + * @version $Revision$ + */ + +class Doctrine_Ticket_587_TestCase extends Doctrine_UnitTestCase +{ + public function prepareTables() + { + $this->tables = array_merge($this->tables, array('BookmarkUser', 'Bookmark', 'Page')); + parent::prepareTables(); + } + public function prepareData() + { + parent::prepareData(); + } + + public function testInit() + { + $user = new BookmarkUser(); + $user['name'] = 'Anonymous'; + $user->save(); + + $pages = new Doctrine_Collection('Page'); + $pages[0]['name'] = 'Yahoo'; + $pages[0]['url'] = 'http://www.yahoo.com'; + $pages->save(); + + $this->assertEqual(count($pages), 1); + } + + /** + * This test case demonstrates an issue with the identity case in the + * Doctrine_Table class. The brief summary is that if you create a + * record, then delete it, then create another record with the same + * primary keys, the record can get into a state where it is in the + * database but may appear to be marked as TCLEAN under certain + * circumstances (such as when it comes back as part of a collection). + * This makes the $record->exists() method return false, which prevents + * the record from being deleted among other things. + */ + public function testIdentityMapAndRecordStatus() + { + // load our user and our collection of pages + $user = Doctrine_Query::create()->query( + 'SELECT * FROM BookmarkUser u WHERE u.name=?', array('Anonymous') + )->getFirst(); + $pages = Doctrine_Query::create()->query('SELECT * FROM Page'); + + // bookmark the pages (manually) + foreach ($pages as $page) { + $bookmark = new Bookmark(); + $bookmark['page_id'] = $page['id']; + $bookmark['user_id'] = $user['id']; + $bookmark->save(); + } + + // select all bookmarks + $bookmarks = Doctrine_Manager::connection()->query( + 'SELECT * FROM Bookmark b' + ); + $this->assertEqual(count($bookmarks), 1); + + // verify that they all exist + foreach ($bookmarks as $bookmark) { + $this->assertTrue($bookmark->exists()); + } + + // now delete them all. + $user['Bookmarks']->delete(); + + // verify count when accessed directly from database + $bookmarks = Doctrine_Query::create()->query( + 'SELECT * FROM Bookmark' + ); + $this->assertEqual(count($bookmarks), 0); + + // now recreate bookmarks and verify they exist: + foreach ($pages as $page) { + $bookmark = new Bookmark(); + $bookmark['page_id'] = $page['id']; + $bookmark['user_id'] = $user['id']; + $bookmark->save(); + } + + // select all bookmarks for the user + $bookmarks = Doctrine_Manager::connection()->query( + 'SELECT * FROM Bookmark b' + ); + $this->assertEqual(count($bookmarks), 1); + + // verify that they all exist + foreach ($bookmarks as $bookmark) { + $this->assertTrue($bookmark->exists()); + } + } +} diff --git a/tests/run.php b/tests/run.php index 85e107861..db2ff96b8 100644 --- a/tests/run.php +++ b/tests/run.php @@ -1,258 +1,259 @@ -addTestCase(new Doctrine_Ticket_Njero_TestCase()); -$tickets->addTestCase(new Doctrine_Ticket_428_TestCase()); -//If you write a ticket testcase add it here like shown above! -$test->addTestCase($tickets); - -// Connection drivers (not yet fully tested) -$driver = new GroupTest("Driver tests", 'driver'); -$driver->addTestCase(new Doctrine_Connection_Pgsql_TestCase()); -$driver->addTestCase(new Doctrine_Connection_Oracle_TestCase()); -$driver->addTestCase(new Doctrine_Connection_Sqlite_TestCase()); -$driver->addTestCase(new Doctrine_Connection_Mssql_TestCase()); -$driver->addTestCase(new Doctrine_Connection_Mysql_TestCase()); -$driver->addTestCase(new Doctrine_Connection_Firebird_TestCase()); -$driver->addTestCase(new Doctrine_Connection_Informix_TestCase()); -$test->addTestCase($driver); - -// Transaction module (FULLY TESTED) -$transaction = new GroupTest("Transaction tests", 'transaction'); -$transaction->addTestCase(new Doctrine_Transaction_TestCase()); -$transaction->addTestCase(new Doctrine_Transaction_Firebird_TestCase()); -$transaction->addTestCase(new Doctrine_Transaction_Informix_TestCase()); -$transaction->addTestCase(new Doctrine_Transaction_Mysql_TestCase()); -$transaction->addTestCase(new Doctrine_Transaction_Mssql_TestCase()); -$transaction->addTestCase(new Doctrine_Transaction_Pgsql_TestCase()); -$transaction->addTestCase(new Doctrine_Transaction_Oracle_TestCase()); -$transaction->addTestCase(new Doctrine_Transaction_Sqlite_TestCase()); -$test->addTestCase($transaction); - -// DataDict module (FULLY TESTED) -$data_dict = new GroupTest('DataDict tests', 'data_dict'); -$data_dict->addTestCase(new Doctrine_DataDict_TestCase()); -$data_dict->addTestCase(new Doctrine_DataDict_Firebird_TestCase()); -$data_dict->addTestCase(new Doctrine_DataDict_Informix_TestCase()); -$data_dict->addTestCase(new Doctrine_DataDict_Mysql_TestCase()); -$data_dict->addTestCase(new Doctrine_DataDict_Mssql_TestCase()); -$data_dict->addTestCase(new Doctrine_DataDict_Pgsql_TestCase()); -$data_dict->addTestCase(new Doctrine_DataDict_Oracle_TestCase()); -$data_dict->addTestCase(new Doctrine_DataDict_Sqlite_TestCase()); -$test->addTestCase($data_dict); - -// Sequence module (not yet fully tested) -$sequence = new GroupTest('Sequence tests','sequence'); -$sequence->addTestCase(new Doctrine_Sequence_TestCase()); -$sequence->addTestCase(new Doctrine_Sequence_Firebird_TestCase()); -$sequence->addTestCase(new Doctrine_Sequence_Informix_TestCase()); -$sequence->addTestCase(new Doctrine_Sequence_Mysql_TestCase()); -$sequence->addTestCase(new Doctrine_Sequence_Mssql_TestCase()); -$sequence->addTestCase(new Doctrine_Sequence_Pgsql_TestCase()); -$sequence->addTestCase(new Doctrine_Sequence_Oracle_TestCase()); -$sequence->addTestCase(new Doctrine_Sequence_Sqlite_TestCase()); -$test->addTestCase($sequence); - -// Export module (not yet fully tested) -$export = new GroupTest('Export tests','export'); -//$export->addTestCase(new Doctrine_Export_Reporter_TestCase()); -$export->addTestCase(new Doctrine_Export_Firebird_TestCase()); -$export->addTestCase(new Doctrine_Export_Informix_TestCase()); -$export->addTestCase(new Doctrine_Export_TestCase()); -$export->addTestCase(new Doctrine_Export_Mssql_TestCase()); -$export->addTestCase(new Doctrine_Export_Pgsql_TestCase()); -$export->addTestCase(new Doctrine_Export_Oracle_TestCase()); -$export->addTestCase(new Doctrine_Export_Record_TestCase()); -$export->addTestCase(new Doctrine_Export_Mysql_TestCase()); -$export->addTestCase(new Doctrine_Export_Sqlite_TestCase()); -$test->addTestCase($export); - -//$test->addTestCase(new Doctrine_CascadingDelete_TestCase()); - -// Import module (not yet fully tested) -$import = new GroupTest('Import tests','import'); -//$import->addTestCase(new Doctrine_Import_TestCase()); -$import->addTestCase(new Doctrine_Import_Firebird_TestCase()); -$import->addTestCase(new Doctrine_Import_Informix_TestCase()); -$import->addTestCase(new Doctrine_Import_Mysql_TestCase()); -$import->addTestCase(new Doctrine_Import_Mssql_TestCase()); -$import->addTestCase(new Doctrine_Import_Pgsql_TestCase()); -$import->addTestCase(new Doctrine_Import_Oracle_TestCase()); -$import->addTestCase(new Doctrine_Import_Sqlite_TestCase()); -$test->addTestCase($import); - -// Expression module (not yet fully tested) -$expression = new GroupTest('Expression tests','expression'); -$expression->addTestCase(new Doctrine_Expression_TestCase()); -$expression->addTestCase(new Doctrine_Expression_Driver_TestCase()); -$expression->addTestCase(new Doctrine_Expression_Firebird_TestCase()); -$expression->addTestCase(new Doctrine_Expression_Informix_TestCase()); -$expression->addTestCase(new Doctrine_Expression_Mysql_TestCase()); -$expression->addTestCase(new Doctrine_Expression_Mssql_TestCase()); -$expression->addTestCase(new Doctrine_Expression_Pgsql_TestCase()); -$expression->addTestCase(new Doctrine_Expression_Oracle_TestCase()); -$expression->addTestCase(new Doctrine_Expression_Sqlite_TestCase()); -$test->addTestCase($expression); - -// Core -$core = new GroupTest('Core tests: Access, Configurable, Manager, Connection, Table, UnitOfWork, Collection, Hydrate, Tokenizer','core'); -$core->addTestCase(new Doctrine_Access_TestCase()); -//$core->addTestCase(new Doctrine_Configurable_TestCase()); -$core->addTestCase(new Doctrine_Manager_TestCase()); -$core->addTestCase(new Doctrine_Connection_TestCase()); -$core->addTestCase(new Doctrine_Table_TestCase()); -$core->addTestCase(new Doctrine_UnitOfWork_TestCase()); -//$core->addTestCase(new Doctrine_Collection_TestCase()); -$core->addTestCase(new Doctrine_Collection_Snapshot_TestCase()); -$core->addTestCase(new Doctrine_Hydrate_FetchMode_TestCase()); -$core->addTestCase(new Doctrine_Tokenizer_TestCase()); -//$core->addTestCase(new Doctrine_Collection_Offset_TestCase()); -//$core->addTestCase(new Doctrine_BatchIterator_TestCase()); -$core->addTestCase(new Doctrine_Hydrate_TestCase()); -$test->addTestCase($core); - -// Relation handling -$relation = new GroupTest('Relation tests: includes TreeStructure','relation'); -$relation->addTestCase(new Doctrine_TreeStructure_TestCase()); -$relation->addTestCase(new Doctrine_Relation_TestCase()); -//$relation->addTestCase(new Doctrine_Relation_Access_TestCase()); -//$relation->addTestCase(new Doctrine_Relation_ManyToMany_TestCase()); -$relation->addTestCase(new Doctrine_Relation_ManyToMany2_TestCase()); -$relation->addTestCase(new Doctrine_Relation_OneToMany_TestCase()); -$relation->addTestCase(new Doctrine_Relation_Nest_TestCase()); -$relation->addTestCase(new Doctrine_Relation_OneToOne_TestCase()); -$relation->addTestCase(new Doctrine_Relation_Parser_TestCase()); -$test->addTestCase($relation); - -// Datatypes -$data_types = new GroupTest('DataTypes tests: Enum and Boolean','data_types'); -$data_types->addTestCase(new Doctrine_DataType_Enum_TestCase()); -$data_types->addTestCase(new Doctrine_DataType_Boolean_TestCase()); -$test->addTestCase($data_types); - -// Utility components -$plugins = new GroupTest('Plugin tests: View, Validator, Hook','plugins'); -//$utility->addTestCase(new Doctrine_PessimisticLocking_TestCase()); -$plugins->addTestCase(new Doctrine_View_TestCase()); -$plugins->addTestCase(new Doctrine_AuditLog_TestCase()); -$plugins->addTestCase(new Doctrine_Validator_TestCase()); -$plugins->addTestCase(new Doctrine_Validator_Future_TestCase()); -$plugins->addTestCase(new Doctrine_Validator_Past_TestCase()); -$plugins->addTestCase(new Doctrine_Hook_TestCase()); -$plugins->addTestCase(new Doctrine_I18n_TestCase()); -$test->addTestCase($plugins); - -// Db component -$db = new GroupTest('Db tests: Db and Profiler','db'); -$db->addTestCase(new Doctrine_Db_TestCase()); -$db->addTestCase(new Doctrine_Connection_Profiler_TestCase()); -$test->addTestCase($db); - -// Eventlisteners -$event_listener = new GroupTest('EventListener tests','event_listener'); -$event_listener->addTestCase(new Doctrine_EventListener_TestCase()); -$event_listener->addTestCase(new Doctrine_EventListener_Chain_TestCase()); -$test->addTestCase($event_listener); - -// Query tests -$query_tests = new GroupTest('Query tests','query_test'); -$query_tests->addTestCase(new Doctrine_Query_Condition_TestCase()); -$query_tests->addTestCase(new Doctrine_Query_MultiJoin_TestCase()); -$query_tests->addTestCase(new Doctrine_Query_MultiJoin2_TestCase()); -$query_tests->addTestCase(new Doctrine_Query_ReferenceModel_TestCase()); -$query_tests->addTestCase(new Doctrine_Query_ComponentAlias_TestCase()); -$query_tests->addTestCase(new Doctrine_Query_ShortAliases_TestCase()); -$query_tests->addTestCase(new Doctrine_Query_Expression_TestCase()); -$query_tests->addTestCase(new Doctrine_Query_OneToOneFetching_TestCase()); -$query_tests->addTestCase(new Doctrine_Query_Check_TestCase()); -$query_tests->addTestCase(new Doctrine_Query_Limit_TestCase()); -//$query_tests->addTestCase(new Doctrine_Query_IdentifierQuoting_TestCase()); -$query_tests->addTestCase(new Doctrine_Query_Update_TestCase()); -$query_tests->addTestCase(new Doctrine_Query_Delete_TestCase()); -$query_tests->addTestCase(new Doctrine_Query_Join_TestCase()); -$query_tests->addTestCase(new Doctrine_Query_Having_TestCase()); -$query_tests->addTestCase(new Doctrine_Query_Orderby_TestCase()); -$query_tests->addTestCase(new Doctrine_Query_Subquery_TestCase()); -$query_tests->addTestCase(new Doctrine_Query_Driver_TestCase()); -$query_tests->addTestCase(new Doctrine_Record_Hook_TestCase()); -$query_tests->addTestCase(new Doctrine_Query_AggregateValue_TestCase()); -$query_tests->addTestCase(new Doctrine_Query_Where_TestCase()); -$query_tests->addTestCase(new Doctrine_Query_From_TestCase()); -$query_tests->addTestCase(new Doctrine_Query_Select_TestCase()); -$query_tests->addTestCase(new Doctrine_Query_JoinCondition_TestCase()); -$query_tests->addTestCase(new Doctrine_Query_MultipleAggregateValue_TestCase()); -$query_tests->addTestCase(new Doctrine_Query_TestCase()); -$query_tests->addTestCase(new Doctrine_Query_MysqlSubquery_TestCase()); -$query_tests->addTestCase(new Doctrine_Query_PgsqlSubquery_TestCase()); -$query_tests->addTestCase(new Doctrine_Query_MysqlSubqueryHaving_TestCase()); -$query_tests->addTestCase(new Doctrine_Query_SelectExpression_TestCase()); -$query_tests->addTestCase(new Doctrine_Query_Registry_TestCase()); -$test->addTestCase($query_tests); - -// Record -$record = new GroupTest('Record tests','record'); -$record->addTestCase(new Doctrine_Record_Filter_TestCase()); -$record->addTestCase(new Doctrine_Record_TestCase()); -$record->addTestCase(new Doctrine_Record_State_TestCase()); -$record->addTestCase(new Doctrine_Record_SerializeUnserialize_TestCase()); -// This test used to segfault php because of infinite recursion in Connection/UnitOfWork -$record->addTestCase(new Doctrine_Record_Lock_TestCase()); -$record->addTestCase(new Doctrine_Record_ZeroValues_TestCase()); -//$record->addTestCase(new Doctrine_Record_SaveBlankRecord_TestCase()); -$test->addTestCase($record); - -$test->addTestCase(new Doctrine_CustomPrimaryKey_TestCase()); -$test->addTestCase(new Doctrine_CustomResultSetOrder_TestCase()); - - -$test->addTestCase(new Doctrine_ColumnAggregationInheritance_TestCase()); - -$test->addTestCase(new Doctrine_ColumnAlias_TestCase()); - - -$test->addTestCase(new Doctrine_RawSql_TestCase()); - -$test->addTestCase(new Doctrine_NewCore_TestCase()); - -$test->addTestCase(new Doctrine_Template_TestCase()); - -//$test->addTestCase(new Doctrine_Import_Builder_TestCase()); - - -//$test->addTestCase(new Doctrine_IntegrityAction_TestCase()); - -$test->addTestCase(new Doctrine_NestedSet_SingleRoot_TestCase()); - -// Search tests -$search = new GroupTest('Search tests','search'); -$search->addTestCase(new Doctrine_Search_TestCase()); -$search->addTestCase(new Doctrine_Search_Query_TestCase()); -$search->addTestCase(new Doctrine_Search_File_TestCase()); - -$test->addTestCase($search); - -// Cache tests -$cache = new GroupTest('Cache tests','cache'); -$cache->addTestCase(new Doctrine_Query_Cache_TestCase()); -$cache->addTestCase(new Doctrine_Cache_Apc_TestCase()); -//$cache->addTestCase(new Doctrine_Cache_Memcache_TestCase()); -//$cache->addTestCase(new Doctrine_Cache_Sqlite_TestCase()); -//$cache->addTestCase(new Doctrine_Cache_Query_SqliteTestCase()); -//$cache->addTestCase(new Doctrine_Cache_FileTestCase()); -//$cache->addTestCase(new Doctrine_Cache_SqliteTestCase()); -//$cache->addTestCase(new Doctrine_Cache_TestCase()); -$test->addTestCase($cache); - +addTestCase(new Doctrine_Ticket_Njero_TestCase()); +$tickets->addTestCase(new Doctrine_Ticket_428_TestCase()); +$tickets->addTestCase(new Doctrine_Ticket_587_TestCase()); +//If you write a ticket testcase add it here like shown above! +$test->addTestCase($tickets); + +// Connection drivers (not yet fully tested) +$driver = new GroupTest("Driver tests", 'driver'); +$driver->addTestCase(new Doctrine_Connection_Pgsql_TestCase()); +$driver->addTestCase(new Doctrine_Connection_Oracle_TestCase()); +$driver->addTestCase(new Doctrine_Connection_Sqlite_TestCase()); +$driver->addTestCase(new Doctrine_Connection_Mssql_TestCase()); +$driver->addTestCase(new Doctrine_Connection_Mysql_TestCase()); +$driver->addTestCase(new Doctrine_Connection_Firebird_TestCase()); +$driver->addTestCase(new Doctrine_Connection_Informix_TestCase()); +$test->addTestCase($driver); + +// Transaction module (FULLY TESTED) +$transaction = new GroupTest("Transaction tests", 'transaction'); +$transaction->addTestCase(new Doctrine_Transaction_TestCase()); +$transaction->addTestCase(new Doctrine_Transaction_Firebird_TestCase()); +$transaction->addTestCase(new Doctrine_Transaction_Informix_TestCase()); +$transaction->addTestCase(new Doctrine_Transaction_Mysql_TestCase()); +$transaction->addTestCase(new Doctrine_Transaction_Mssql_TestCase()); +$transaction->addTestCase(new Doctrine_Transaction_Pgsql_TestCase()); +$transaction->addTestCase(new Doctrine_Transaction_Oracle_TestCase()); +$transaction->addTestCase(new Doctrine_Transaction_Sqlite_TestCase()); +$test->addTestCase($transaction); + +// DataDict module (FULLY TESTED) +$data_dict = new GroupTest('DataDict tests', 'data_dict'); +$data_dict->addTestCase(new Doctrine_DataDict_TestCase()); +$data_dict->addTestCase(new Doctrine_DataDict_Firebird_TestCase()); +$data_dict->addTestCase(new Doctrine_DataDict_Informix_TestCase()); +$data_dict->addTestCase(new Doctrine_DataDict_Mysql_TestCase()); +$data_dict->addTestCase(new Doctrine_DataDict_Mssql_TestCase()); +$data_dict->addTestCase(new Doctrine_DataDict_Pgsql_TestCase()); +$data_dict->addTestCase(new Doctrine_DataDict_Oracle_TestCase()); +$data_dict->addTestCase(new Doctrine_DataDict_Sqlite_TestCase()); +$test->addTestCase($data_dict); + +// Sequence module (not yet fully tested) +$sequence = new GroupTest('Sequence tests','sequence'); +$sequence->addTestCase(new Doctrine_Sequence_TestCase()); +$sequence->addTestCase(new Doctrine_Sequence_Firebird_TestCase()); +$sequence->addTestCase(new Doctrine_Sequence_Informix_TestCase()); +$sequence->addTestCase(new Doctrine_Sequence_Mysql_TestCase()); +$sequence->addTestCase(new Doctrine_Sequence_Mssql_TestCase()); +$sequence->addTestCase(new Doctrine_Sequence_Pgsql_TestCase()); +$sequence->addTestCase(new Doctrine_Sequence_Oracle_TestCase()); +$sequence->addTestCase(new Doctrine_Sequence_Sqlite_TestCase()); +$test->addTestCase($sequence); + +// Export module (not yet fully tested) +$export = new GroupTest('Export tests','export'); +//$export->addTestCase(new Doctrine_Export_Reporter_TestCase()); +$export->addTestCase(new Doctrine_Export_Firebird_TestCase()); +$export->addTestCase(new Doctrine_Export_Informix_TestCase()); +$export->addTestCase(new Doctrine_Export_TestCase()); +$export->addTestCase(new Doctrine_Export_Mssql_TestCase()); +$export->addTestCase(new Doctrine_Export_Pgsql_TestCase()); +$export->addTestCase(new Doctrine_Export_Oracle_TestCase()); +$export->addTestCase(new Doctrine_Export_Record_TestCase()); +$export->addTestCase(new Doctrine_Export_Mysql_TestCase()); +$export->addTestCase(new Doctrine_Export_Sqlite_TestCase()); +$test->addTestCase($export); + +//$test->addTestCase(new Doctrine_CascadingDelete_TestCase()); + +// Import module (not yet fully tested) +$import = new GroupTest('Import tests','import'); +//$import->addTestCase(new Doctrine_Import_TestCase()); +$import->addTestCase(new Doctrine_Import_Firebird_TestCase()); +$import->addTestCase(new Doctrine_Import_Informix_TestCase()); +$import->addTestCase(new Doctrine_Import_Mysql_TestCase()); +$import->addTestCase(new Doctrine_Import_Mssql_TestCase()); +$import->addTestCase(new Doctrine_Import_Pgsql_TestCase()); +$import->addTestCase(new Doctrine_Import_Oracle_TestCase()); +$import->addTestCase(new Doctrine_Import_Sqlite_TestCase()); +$test->addTestCase($import); + +// Expression module (not yet fully tested) +$expression = new GroupTest('Expression tests','expression'); +$expression->addTestCase(new Doctrine_Expression_TestCase()); +$expression->addTestCase(new Doctrine_Expression_Driver_TestCase()); +$expression->addTestCase(new Doctrine_Expression_Firebird_TestCase()); +$expression->addTestCase(new Doctrine_Expression_Informix_TestCase()); +$expression->addTestCase(new Doctrine_Expression_Mysql_TestCase()); +$expression->addTestCase(new Doctrine_Expression_Mssql_TestCase()); +$expression->addTestCase(new Doctrine_Expression_Pgsql_TestCase()); +$expression->addTestCase(new Doctrine_Expression_Oracle_TestCase()); +$expression->addTestCase(new Doctrine_Expression_Sqlite_TestCase()); +$test->addTestCase($expression); + +// Core +$core = new GroupTest('Core tests: Access, Configurable, Manager, Connection, Table, UnitOfWork, Collection, Hydrate, Tokenizer','core'); +$core->addTestCase(new Doctrine_Access_TestCase()); +//$core->addTestCase(new Doctrine_Configurable_TestCase()); +$core->addTestCase(new Doctrine_Manager_TestCase()); +$core->addTestCase(new Doctrine_Connection_TestCase()); +$core->addTestCase(new Doctrine_Table_TestCase()); +$core->addTestCase(new Doctrine_UnitOfWork_TestCase()); +//$core->addTestCase(new Doctrine_Collection_TestCase()); +$core->addTestCase(new Doctrine_Collection_Snapshot_TestCase()); +$core->addTestCase(new Doctrine_Hydrate_FetchMode_TestCase()); +$core->addTestCase(new Doctrine_Tokenizer_TestCase()); +//$core->addTestCase(new Doctrine_Collection_Offset_TestCase()); +//$core->addTestCase(new Doctrine_BatchIterator_TestCase()); +$core->addTestCase(new Doctrine_Hydrate_TestCase()); +$test->addTestCase($core); + +// Relation handling +$relation = new GroupTest('Relation tests: includes TreeStructure','relation'); +$relation->addTestCase(new Doctrine_TreeStructure_TestCase()); +$relation->addTestCase(new Doctrine_Relation_TestCase()); +//$relation->addTestCase(new Doctrine_Relation_Access_TestCase()); +//$relation->addTestCase(new Doctrine_Relation_ManyToMany_TestCase()); +$relation->addTestCase(new Doctrine_Relation_ManyToMany2_TestCase()); +$relation->addTestCase(new Doctrine_Relation_OneToMany_TestCase()); +$relation->addTestCase(new Doctrine_Relation_Nest_TestCase()); +$relation->addTestCase(new Doctrine_Relation_OneToOne_TestCase()); +$relation->addTestCase(new Doctrine_Relation_Parser_TestCase()); +$test->addTestCase($relation); + +// Datatypes +$data_types = new GroupTest('DataTypes tests: Enum and Boolean','data_types'); +$data_types->addTestCase(new Doctrine_DataType_Enum_TestCase()); +$data_types->addTestCase(new Doctrine_DataType_Boolean_TestCase()); +$test->addTestCase($data_types); + +// Utility components +$plugins = new GroupTest('Plugin tests: View, Validator, Hook','plugins'); +//$utility->addTestCase(new Doctrine_PessimisticLocking_TestCase()); +$plugins->addTestCase(new Doctrine_View_TestCase()); +$plugins->addTestCase(new Doctrine_AuditLog_TestCase()); +$plugins->addTestCase(new Doctrine_Validator_TestCase()); +$plugins->addTestCase(new Doctrine_Validator_Future_TestCase()); +$plugins->addTestCase(new Doctrine_Validator_Past_TestCase()); +$plugins->addTestCase(new Doctrine_Hook_TestCase()); +$plugins->addTestCase(new Doctrine_I18n_TestCase()); +$test->addTestCase($plugins); + +// Db component +$db = new GroupTest('Db tests: Db and Profiler','db'); +$db->addTestCase(new Doctrine_Db_TestCase()); +$db->addTestCase(new Doctrine_Connection_Profiler_TestCase()); +$test->addTestCase($db); + +// Eventlisteners +$event_listener = new GroupTest('EventListener tests','event_listener'); +$event_listener->addTestCase(new Doctrine_EventListener_TestCase()); +$event_listener->addTestCase(new Doctrine_EventListener_Chain_TestCase()); +$test->addTestCase($event_listener); + +// Query tests +$query_tests = new GroupTest('Query tests','query_test'); +$query_tests->addTestCase(new Doctrine_Query_Condition_TestCase()); +$query_tests->addTestCase(new Doctrine_Query_MultiJoin_TestCase()); +$query_tests->addTestCase(new Doctrine_Query_MultiJoin2_TestCase()); +$query_tests->addTestCase(new Doctrine_Query_ReferenceModel_TestCase()); +$query_tests->addTestCase(new Doctrine_Query_ComponentAlias_TestCase()); +$query_tests->addTestCase(new Doctrine_Query_ShortAliases_TestCase()); +$query_tests->addTestCase(new Doctrine_Query_Expression_TestCase()); +$query_tests->addTestCase(new Doctrine_Query_OneToOneFetching_TestCase()); +$query_tests->addTestCase(new Doctrine_Query_Check_TestCase()); +$query_tests->addTestCase(new Doctrine_Query_Limit_TestCase()); +//$query_tests->addTestCase(new Doctrine_Query_IdentifierQuoting_TestCase()); +$query_tests->addTestCase(new Doctrine_Query_Update_TestCase()); +$query_tests->addTestCase(new Doctrine_Query_Delete_TestCase()); +$query_tests->addTestCase(new Doctrine_Query_Join_TestCase()); +$query_tests->addTestCase(new Doctrine_Query_Having_TestCase()); +$query_tests->addTestCase(new Doctrine_Query_Orderby_TestCase()); +$query_tests->addTestCase(new Doctrine_Query_Subquery_TestCase()); +$query_tests->addTestCase(new Doctrine_Query_Driver_TestCase()); +$query_tests->addTestCase(new Doctrine_Record_Hook_TestCase()); +$query_tests->addTestCase(new Doctrine_Query_AggregateValue_TestCase()); +$query_tests->addTestCase(new Doctrine_Query_Where_TestCase()); +$query_tests->addTestCase(new Doctrine_Query_From_TestCase()); +$query_tests->addTestCase(new Doctrine_Query_Select_TestCase()); +$query_tests->addTestCase(new Doctrine_Query_JoinCondition_TestCase()); +$query_tests->addTestCase(new Doctrine_Query_MultipleAggregateValue_TestCase()); +$query_tests->addTestCase(new Doctrine_Query_TestCase()); +$query_tests->addTestCase(new Doctrine_Query_MysqlSubquery_TestCase()); +$query_tests->addTestCase(new Doctrine_Query_PgsqlSubquery_TestCase()); +$query_tests->addTestCase(new Doctrine_Query_MysqlSubqueryHaving_TestCase()); +$query_tests->addTestCase(new Doctrine_Query_SelectExpression_TestCase()); +$query_tests->addTestCase(new Doctrine_Query_Registry_TestCase()); +$test->addTestCase($query_tests); + +// Record +$record = new GroupTest('Record tests','record'); +$record->addTestCase(new Doctrine_Record_Filter_TestCase()); +$record->addTestCase(new Doctrine_Record_TestCase()); +$record->addTestCase(new Doctrine_Record_State_TestCase()); +$record->addTestCase(new Doctrine_Record_SerializeUnserialize_TestCase()); +// This test used to segfault php because of infinite recursion in Connection/UnitOfWork +$record->addTestCase(new Doctrine_Record_Lock_TestCase()); +$record->addTestCase(new Doctrine_Record_ZeroValues_TestCase()); +//$record->addTestCase(new Doctrine_Record_SaveBlankRecord_TestCase()); +$test->addTestCase($record); + +$test->addTestCase(new Doctrine_CustomPrimaryKey_TestCase()); +$test->addTestCase(new Doctrine_CustomResultSetOrder_TestCase()); + + +$test->addTestCase(new Doctrine_ColumnAggregationInheritance_TestCase()); + +$test->addTestCase(new Doctrine_ColumnAlias_TestCase()); + + +$test->addTestCase(new Doctrine_RawSql_TestCase()); + +$test->addTestCase(new Doctrine_NewCore_TestCase()); + +$test->addTestCase(new Doctrine_Template_TestCase()); + +//$test->addTestCase(new Doctrine_Import_Builder_TestCase()); + + +//$test->addTestCase(new Doctrine_IntegrityAction_TestCase()); + +$test->addTestCase(new Doctrine_NestedSet_SingleRoot_TestCase()); + +// Search tests +$search = new GroupTest('Search tests','search'); +$search->addTestCase(new Doctrine_Search_TestCase()); +$search->addTestCase(new Doctrine_Search_Query_TestCase()); +$search->addTestCase(new Doctrine_Search_File_TestCase()); + +$test->addTestCase($search); + +// Cache tests +$cache = new GroupTest('Cache tests','cache'); +$cache->addTestCase(new Doctrine_Query_Cache_TestCase()); +$cache->addTestCase(new Doctrine_Cache_Apc_TestCase()); +//$cache->addTestCase(new Doctrine_Cache_Memcache_TestCase()); +//$cache->addTestCase(new Doctrine_Cache_Sqlite_TestCase()); +//$cache->addTestCase(new Doctrine_Cache_Query_SqliteTestCase()); +//$cache->addTestCase(new Doctrine_Cache_FileTestCase()); +//$cache->addTestCase(new Doctrine_Cache_SqliteTestCase()); +//$cache->addTestCase(new Doctrine_Cache_TestCase()); +$test->addTestCase($cache); + // Migration Tests $migration = new GroupTest('Migration tests','migration'); $migration->addTestCase(new Doctrine_Migration_TestCase()); @@ -260,7 +261,7 @@ $migration->addTestCase(new Doctrine_Migration_Mysql_TestCase()); $test->addTestCase($migration); $test->addTestCase(new Doctrine_Query_ApplyInheritance_TestCase()); -$test->addTestCase(new Doctrine_Import_Schema_TestCase()); -$test->addTestCase(new Doctrine_Export_Schema_TestCase()); +$test->addTestCase(new Doctrine_Import_Schema_TestCase()); +$test->addTestCase(new Doctrine_Export_Schema_TestCase()); -$test->run(); +$test->run();