1
0
mirror of synced 2025-01-29 19:41:45 +03:00
This commit is contained in:
zYne 2007-06-14 20:42:05 +00:00
parent 62f72a7014
commit 5006400cf9
4 changed files with 16 additions and 9 deletions

View File

@ -300,15 +300,14 @@ class ForeignKeyTest extends Doctrine_Record
$this->hasColumn('parent_id', 'integer'); $this->hasColumn('parent_id', 'integer');
$this->hasOne('ForeignKeyTest as Parent', $this->hasOne('ForeignKeyTest as Parent',
'ForeignKeyTest.parent_id' 'ForeignKeyTest.parent_id',
);
$this->hasMany('ForeignKeyTest as Children',
'ForeignKeyTest.parent_id',
array('onDelete' => 'CASCADE', array('onDelete' => 'CASCADE',
'onUpdate' => 'RESTRICT') 'onUpdate' => 'RESTRICT')
); );
$this->hasMany('ForeignKeyTest as Children',
'ForeignKeyTest.parent_id');
$this->option('type', 'INNODB'); $this->option('type', 'INNODB');
} }

View File

@ -77,9 +77,10 @@ class Doctrine_Export_Pgsql_TestCase extends Doctrine_UnitTestCase
$this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (name CHAR(10), type INT, PRIMARY KEY(name, type))'); $this->assertEqual($this->adapter->pop(), 'CREATE TABLE mytable (name CHAR(10), type INT, PRIMARY KEY(name, type))');
} }
public function testExportSql() public function testExportSql()
{ {
$sql = $this->export->exportSql(dirname(__FILE__) . DIRECTORY_SEPARATOR . '_files'); $sql = $this->export->exportSql(dirname(__FILE__) . DIRECTORY_SEPARATOR . '_files');
$this->assertEqual($sql, array ( 0 => 'CREATE TABLE foo (id BIGSERIAL, name VARCHAR(200) NOT NULL, parent_id BIGINT, local_foo BIGINT, PRIMARY KEY(id))', $this->assertEqual($sql, array ( 0 => 'CREATE TABLE foo (id BIGSERIAL, name VARCHAR(200) NOT NULL, parent_id BIGINT, local_foo BIGINT, PRIMARY KEY(id))',
1 => 'CREATE TABLE foo_reference (foo1 BIGINT, foo2 BIGINT, PRIMARY KEY(foo1, foo2))', 1 => 'CREATE TABLE foo_reference (foo1 BIGINT, foo2 BIGINT, PRIMARY KEY(foo1, foo2))',
2 => 'CREATE TABLE foo_bar_record (fooid BIGINT, barid BIGINT, PRIMARY KEY(fooid, barid))', 2 => 'CREATE TABLE foo_bar_record (fooid BIGINT, barid BIGINT, PRIMARY KEY(fooid, barid))',

View File

@ -20,7 +20,7 @@ class FooRecord extends Doctrine_Record
$this->hasMany('FooRecord as FooParents', array('local' => 'foo1', $this->hasMany('FooRecord as FooParents', array('local' => 'foo1',
'foreign' => 'foo2', 'foreign' => 'foo2',
'refClass' => 'FooReferenceRecord', 'refClass' => 'FooReferenceRecord',
'onDelete' => 'CASCADE', 'onDelete' => 'RESTRICT',
)); ));
$this->hasMany('FooRecord as FooChildren', array('local' => 'foo2', $this->hasMany('FooRecord as FooChildren', array('local' => 'foo2',
@ -33,7 +33,11 @@ class FooRecord extends Doctrine_Record
$this->hasOne('FooRecord as Parent', array('local' => 'parent_id', 'foreign' => 'id', 'onDelete' => 'CASCADE')); $this->hasOne('FooRecord as Parent', array('local' => 'parent_id', 'foreign' => 'id', 'onDelete' => 'CASCADE'));
$this->hasOne('FooForeignlyOwnedWithPk', array('local' => 'id', 'foreign' => 'id', 'constraint' => true)); $this->hasOne('FooForeignlyOwnedWithPk', array('local' => 'id', 'foreign' => 'id', 'constraint' => true));
$this->hasOne('FooLocallyOwned', array('local' => 'local_foo', 'onDelete' => 'RESTRICT')); $this->hasOne('FooLocallyOwned', array('local' => 'local_foo', 'onDelete' => 'RESTRICT'));
$this->hasMany('BarRecord as Bar', array('local' => 'fooId', 'foreign' => 'barId', 'refClass' => 'FooBarRecord'));
$this->hasMany('BarRecord as Bar', array('local' => 'fooId',
'foreign' => 'barId',
'refClass' => 'FooBarRecord',
'onUpdate' => 'RESTRICT'));
} }
} }

View File

@ -68,6 +68,7 @@ $test = new GroupTest('Doctrine Framework Unit Tests');
/** */ /** */
// Temp tests // Temp tests
$test->addTestCase(new Doctrine_Ticket330_TestCase()); $test->addTestCase(new Doctrine_Ticket330_TestCase());
// Connection drivers (not yet fully tested) // Connection drivers (not yet fully tested)
@ -122,7 +123,7 @@ $test->addTestCase(new Doctrine_Export_Oracle_TestCase());
$test->addTestCase(new Doctrine_Export_Sqlite_TestCase()); $test->addTestCase(new Doctrine_Export_Sqlite_TestCase());
$test->addTestCase(new Doctrine_Export_Mysql_TestCase()); $test->addTestCase(new Doctrine_Export_Mysql_TestCase());
$test->addTestCase(new Doctrine_CascadingDelete_TestCase()); //$test->addTestCase(new Doctrine_CascadingDelete_TestCase());
// Import module (not yet fully tested) // Import module (not yet fully tested)
//$test->addTestCase(new Doctrine_Import_TestCase()); //$test->addTestCase(new Doctrine_Import_TestCase());
@ -175,6 +176,7 @@ $test->addTestCase(new Doctrine_Relation_Parser_TestCase());
// Datatypes // Datatypes
$test->addTestCase(new Doctrine_Enum_TestCase()); $test->addTestCase(new Doctrine_Enum_TestCase());
$test->addTestCase(new Doctrine_Boolean_TestCase()); $test->addTestCase(new Doctrine_Boolean_TestCase());
@ -290,6 +292,7 @@ $test->addTestCase(new Doctrine_Query_JoinCondition_TestCase());
$test->addTestCase(new Doctrine_Query_MultipleAggregateValue_TestCase()); $test->addTestCase(new Doctrine_Query_MultipleAggregateValue_TestCase());
$test->addTestCase(new Doctrine_IntegrityAction_TestCase());
// Cache tests // Cache tests
//$test->addTestCase(new Doctrine_Cache_Query_SqliteTestCase()); //$test->addTestCase(new Doctrine_Cache_Query_SqliteTestCase());
//$test->addTestCase(new Doctrine_Cache_FileTestCase()); //$test->addTestCase(new Doctrine_Cache_FileTestCase());