1
0
mirror of synced 2024-12-13 14:56:01 +03:00

New test case for one-one relation fetching.

This commit is contained in:
romanb 2007-06-05 19:33:09 +00:00
parent 1e2b0bf67b
commit cab7c8ea45
4 changed files with 244 additions and 220 deletions

View File

@ -158,13 +158,12 @@ class Doctrine_CustomResultSetOrder_TestCase extends Doctrine_UnitTestCase {
switch ($category->name) { switch ($category->name) {
case 'First': case 'First':
// The first category should have 3 boards, right? // The first category should have 3 boards
// It has only 1! The other two slipped to the 2nd category!
$this->assertEqual(3, $category->Boards->count()); $this->assertEqual(3, $category->Boards->count());
break; break;
case 'Second': case 'Second':
// The second category should have 1 board, but it got 3 now // The second category should have 1 board
$this->assertEqual(1, $category->Boards->count()); $this->assertEqual(1, $category->Boards->count());
break; break;

View File

@ -36,7 +36,7 @@ class EventListenerTest extends Doctrine_Record {
$this->hasColumn("password", "string", 8); $this->hasColumn("password", "string", 8);
} }
public function setUp() { public function setUp() {
$this->attribute(Doctrine::ATTR_LISTENER, new Doctrine_EventListener_AccessorInvoker()); //$this->attribute(Doctrine::ATTR_LISTENER, new Doctrine_EventListener_AccessorInvoker());
} }
public function getName($name) { public function getName($name) {
return strtoupper($name); return strtoupper($name);

View File

@ -695,9 +695,9 @@ class QueryTest_Entry extends Doctrine_Record
*/ */
public function setTableDefinition() public function setTableDefinition()
{ {
$this->hasColumn('authorId as authorId', 'integer', 4, $this->hasColumn('authorId', 'integer', 4,
array('notnull')); array('notnull'));
$this->hasColumn('date as date', 'integer', 4, $this->hasColumn('date', 'integer', 4,
array('notnull')); array('notnull'));
} }
@ -716,7 +716,32 @@ class QueryTest_User extends Doctrine_Record
public function setTableDefinition() public function setTableDefinition()
{ {
$this->hasColumn('username as username', 'string', 50, $this->hasColumn('username as username', 'string', 50,
array('notnull', 'unique')); array('notnull'));
$this->hasColumn('visibleRankId', 'integer', 4);
}
/**
* Runtime definition of the relationships to other entities.
*/
public function setUp()
{
$this->hasOne('QueryTest_Rank as visibleRank', 'QueryTest_User.visibleRankId');
}
}
class QueryTest_Rank extends Doctrine_Record
{
/**
* Initializes the table definition.
*/
public function setTableDefinition()
{
$this->hasColumn('title as title', 'string', 100,
array('notnull'));
$this->hasColumn('color as color', 'string', 20,
array('notnull', 'regexp' => '/^[a-zA-Z\-]{3,}|#[0-9a-fA-F]{6}$/D'));
$this->hasColumn('icon as icon', 'string', 50,
array('notnull', 'default' => ' ', 'regexp' => '/^[a-zA-Z0-9_\-]+\.(jpg|gif|png)$/D'));
} }
} }

View File

@ -222,7 +222,7 @@ $test->addTestCase(new Doctrine_ColumnAggregationInheritance_TestCase());
$test->addTestCase(new Doctrine_ColumnAlias_TestCase()); $test->addTestCase(new Doctrine_ColumnAlias_TestCase());
$test->addTestCase(new Doctrine_Query_OneToOneFetching_TestCase());
$test->addTestCase(new Doctrine_Cache_Apc_TestCase()); $test->addTestCase(new Doctrine_Cache_Apc_TestCase());
$test->addTestCase(new Doctrine_Cache_Memcache_TestCase()); $test->addTestCase(new Doctrine_Cache_Memcache_TestCase());