adding a test to show a situation where cascading inserts do not work
This commit is contained in:
parent
5cbc3fc817
commit
34a8acba63
29
tests/UnsortedTestCase.php
Normal file
29
tests/UnsortedTestCase.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Tests in this file are unsorted, and should be placed in an appropriate
|
||||
* test file. If you are unsure where to put a unit test, place them in here
|
||||
* and hopefully someone else will move them.
|
||||
*/
|
||||
class Doctrine_UnsortedTestCase extends Doctrine_UnitTestCase {
|
||||
public function testCascadingInsert()
|
||||
{
|
||||
$package = new Package();
|
||||
$package->description = 'Package';
|
||||
|
||||
$packageverison = new PackageVersion();
|
||||
$packageverison->description = 'Version';
|
||||
|
||||
$packageverisonnotes = new PackageVersionNotes();
|
||||
$packageverisonnotes->description = 'Notes';
|
||||
|
||||
$package->Version[0] = $packageverison;
|
||||
$package->Version[0]->Note[0] = $packageverisonnotes;
|
||||
|
||||
$package->save();
|
||||
|
||||
$this->assertNotNull($package->id);
|
||||
$this->assertNotNull($package->Version[0]->id);
|
||||
$this->assertNotNull($package->Version[0]->Note[0]->id);
|
||||
}
|
||||
}
|
@ -68,7 +68,6 @@ class Group extends Entity {
|
||||
parent::setUp();
|
||||
$this->hasMany("User","Groupuser.user_id");
|
||||
$this->setInheritanceMap(array("type"=>1));
|
||||
|
||||
}
|
||||
}
|
||||
class Error extends Doctrine_Record {
|
||||
@ -128,7 +127,7 @@ class Phonenumber extends Doctrine_Record {
|
||||
$this->hasColumn("entity_id","integer");
|
||||
}
|
||||
public function setUp() {
|
||||
$this->hasOne("Entity", "Phonenumber.entity_id");
|
||||
$this->hasOne("Entity", "Phonenumber.entity_id");
|
||||
}
|
||||
}
|
||||
|
||||
@ -558,5 +557,36 @@ class BoardWithPosition extends Doctrine_Record {
|
||||
$this->hasOne("CategoryWithPosition as Category", "BoardWithPosition.category_id");
|
||||
}
|
||||
}
|
||||
class Package extends Doctrine_Record {
|
||||
public function setTableDefinition() {
|
||||
$this->hasColumn('description', 'string', 255);
|
||||
}
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$this->ownsMany('PackageVersion as Version', 'PackageVersion.package_id');
|
||||
}
|
||||
}
|
||||
class PackageVersion extends Doctrine_Record {
|
||||
public function setTableDefinition() {
|
||||
$this->hasColumn('package_id', 'integer');
|
||||
$this->hasColumn('description', 'string', 255);
|
||||
}
|
||||
public function setUp()
|
||||
{
|
||||
$this->hasOne('Package', 'PackageVersion.package_id');
|
||||
$this->hasMany('PackageVersionNotes as Note', 'PackageVersionNotes.package_version_id');
|
||||
}
|
||||
}
|
||||
class PackageVersionNotes extends Doctrine_Record {
|
||||
public function setTableDefinition() {
|
||||
$this->hasColumn('package_version_id', 'integer');
|
||||
$this->hasColumn('description', 'string', 255);
|
||||
}
|
||||
public function setUp()
|
||||
{
|
||||
$this->hasOne('PackageVersion', 'PackageVersionNotes.package_version_id');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -49,6 +49,9 @@ require_once("RelationTestCase.php");
|
||||
require_once("DataDictSqliteTestCase.php");
|
||||
require_once("CustomResultSetOrderTestCase.php");
|
||||
|
||||
// unsorted tests are here, these should be moved somewhere sensible
|
||||
require_once("UnsortedTestCase.php");
|
||||
|
||||
error_reporting(E_ALL);
|
||||
print "<pre>";
|
||||
|
||||
@ -132,6 +135,7 @@ $test->addTestCase(new Doctrine_Query_From_TestCase());
|
||||
|
||||
$test->addTestCase(new Doctrine_Query_Select_TestCase());
|
||||
|
||||
$test->addTestCase(new Doctrine_UnsortedTestCase());
|
||||
|
||||
//$test->addTestCase(new Doctrine_Cache_FileTestCase());
|
||||
//$test->addTestCase(new Doctrine_Cache_SqliteTestCase());
|
||||
|
Loading…
x
Reference in New Issue
Block a user