diff --git a/tests/MigrationTestCase.php b/tests/MigrationTestCase.php index 59b2b336c..7b718ba54 100644 --- a/tests/MigrationTestCase.php +++ b/tests/MigrationTestCase.php @@ -128,29 +128,3 @@ public function testMigrationClassNameInflected() } } } - -class MigrationPhonenumber extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('user_id', 'integer'); - $this->hasColumn('phonenumber', 'string', 255); - } -} - -class MigrationUser extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('username', 'string', 255); - $this->hasColumn('password', 'string', 255); - } -} - -class MigrationProfile extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('name', 'string', 255); - } -} diff --git a/tests/Relation/OneToOneTestCase.php b/tests/Relation/OneToOneTestCase.php index b65f9dcf0..11264350f 100644 --- a/tests/Relation/OneToOneTestCase.php +++ b/tests/Relation/OneToOneTestCase.php @@ -30,14 +30,14 @@ * @since 1.0 * @version $Revision$ */ -class Doctrine_Relation_OneToOne_TestCase extends Doctrine_UnitTestCase +class Doctrine_Relation_OneToOne_TestCase extends Doctrine_UnitTestCase { - public function prepareData() + public function prepareData() { } - public function prepareTables() - { - $this->tables = array('gnatUser','gnatEmail','Email','Entity','Record_City', 'Record_Country', 'SelfRefTest'); - + public function prepareTables() + { + $this->tables = array('GnatUser','GnatEmail','Email','Entity','Record_City', 'Record_Country', 'SelfRefTest'); + parent::prepareTables(); } @@ -46,27 +46,27 @@ public function testOneToOneAggregateRelationWithAliasesIsSupported() $city = new Record_City(); $country = $city->Country; - $this->assertTrue($country instanceof Record_Country); + $this->assertTrue($country instanceof Record_Country); } - + public function testSelfReferentialOneToOneRelationsAreSupported() { $ref = new SelfRefTest(); - + $rel = $ref->getTable()->getRelation('createdBy'); $this->assertEqual($rel->getForeign(), 'id'); $this->assertEqual($rel->getLocal(), 'created_by'); - + $ref->name = 'ref 1'; $ref->createdBy->name = 'ref 2'; - + $ref->save(); } public function testSelfReferentialOneToOneRelationsAreSupported2() { $this->connection->clear(); - + $ref = $this->conn->queryOne("FROM SelfRefTest s WHERE s.name = 'ref 1'"); $this->assertEqual($ref->name, 'ref 1'); $this->assertEqual($ref->createdBy->name, 'ref 2'); @@ -88,14 +88,14 @@ public function testUnsetRelation() public function testSavingRelatedObjects() { - $user = new gnatUser(); + $user = new GnatUser(); $user->name = 'test'; - $email = new gnatEmail(); + $email = new GnatEmail(); $email->address = 'test3@test.com'; $user->Email = $email; $user->save(); - $this->assertTrue($user->Email instanceOf gnatEmail); + $this->assertTrue($user->Email instanceOf GnatEmail); $this->assertEqual($user->foreign_id, $user->Email->id); - + } } diff --git a/tests/models/Blog.php b/tests/models/Blog.php index 00acbb1b1..1dc3018f1 100644 --- a/tests/models/Blog.php +++ b/tests/models/Blog.php @@ -10,23 +10,3 @@ public function setUp() $this->actAs('Taggable'); } } -class Taggable extends Doctrine_Template -{ - public function setUp() - { - //$this->hasMany('[Component]TagTemplate as Tag'); - } -} -class TagTemplate extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('name', 'string', 100); - $this->hasColumn('description', 'string'); - } - - public function setUp() - { - //$this->hasOne('[Component]', array('onDelete' => 'CASCADE')); - } -} diff --git a/tests/models/gnatEmail.php b/tests/models/GnatEmail.php similarity index 69% rename from tests/models/gnatEmail.php rename to tests/models/GnatEmail.php index 209ef6fd3..e07c6b8b6 100644 --- a/tests/models/gnatEmail.php +++ b/tests/models/GnatEmail.php @@ -1,10 +1,8 @@ hasColumn('address', 'string', 150); } - - } diff --git a/tests/models/gnatUser.php b/tests/models/GnatUser.php similarity index 58% rename from tests/models/gnatUser.php rename to tests/models/GnatUser.php index e6a66915b..f336231e3 100644 --- a/tests/models/gnatUser.php +++ b/tests/models/GnatUser.php @@ -1,19 +1,16 @@ -hasColumn('name', 'string', 150); $this->hasColumn('foreign_id', 'integer', 10, array ('unique' => true,)); } - + public function setUp() { parent::setUp(); - $this->hasOne('gnatEmail as Email', array('local'=> 'foreign_id', 'foreign'=>'id', 'onDelete'=>'CASCADE')); + $this->hasOne('GnatEmail as Email', array('local'=> 'foreign_id', 'foreign'=>'id', 'onDelete'=>'CASCADE')); } - -} +} diff --git a/tests/models/GnatUserTable.php b/tests/models/GnatUserTable.php new file mode 100644 index 000000000..f2c039b87 --- /dev/null +++ b/tests/models/GnatUserTable.php @@ -0,0 +1,3 @@ + Doctrine_Connection -// won't initialize grouptable when Doctrine_Connection->getTable('Group') is called -class GroupTable { } - class Group extends Entity { public function setUp() diff --git a/tests/models/GroupTable.php b/tests/models/GroupTable.php new file mode 100644 index 000000000..cc25211eb --- /dev/null +++ b/tests/models/GroupTable.php @@ -0,0 +1,5 @@ + Doctrine_Connection +// won't initialize grouptable when Doctrine_Connection->getTable('Group') is called +class GroupTable { } diff --git a/tests/models/MigrationPhonenumber.php b/tests/models/MigrationPhonenumber.php new file mode 100644 index 000000000..af55ef786 --- /dev/null +++ b/tests/models/MigrationPhonenumber.php @@ -0,0 +1,10 @@ +hasColumn('user_id', 'integer'); + $this->hasColumn('phonenumber', 'string', 255); + } +} diff --git a/tests/models/MigrationProfile.php b/tests/models/MigrationProfile.php new file mode 100644 index 000000000..8302b6751 --- /dev/null +++ b/tests/models/MigrationProfile.php @@ -0,0 +1,9 @@ +hasColumn('name', 'string', 255); + } +} diff --git a/tests/models/MigrationUser.php b/tests/models/MigrationUser.php new file mode 100644 index 000000000..7c366179f --- /dev/null +++ b/tests/models/MigrationUser.php @@ -0,0 +1,10 @@ +hasColumn('username', 'string', 255); + $this->hasColumn('password', 'string', 255); + } +} diff --git a/tests/models/RelationTest.php b/tests/models/RelationTest.php index 2932d7ca0..92f73cf8c 100644 --- a/tests/models/RelationTest.php +++ b/tests/models/RelationTest.php @@ -7,19 +7,3 @@ public function setTableDefinition() $this->hasColumn('parent_id', 'integer'); } } - -class RelationTestChild extends RelationTest -{ - public function setUp() - { - $this->hasOne('RelationTest as Parent', array( - 'local' => 'parent_id', - 'foreign' => 'id', - 'onDelete' => 'CASCADE', - )); - $this->hasMany('RelationTestChild as Children', array( - 'local' => 'id', - 'foreign' => 'parent_id', - )); - } -} diff --git a/tests/models/RelationTestChild.php b/tests/models/RelationTestChild.php new file mode 100644 index 000000000..7f1087e43 --- /dev/null +++ b/tests/models/RelationTestChild.php @@ -0,0 +1,19 @@ +hasOne('RelationTest as Parent', array( + 'local' => 'parent_id', + 'foreign' => 'id', + 'onDelete' => 'CASCADE', + )); + $this->hasMany('RelationTestChild as Children', array( + 'local' => 'id', + 'foreign' => 'parent_id', + )); + } +} diff --git a/tests/models/TagTemplate.php b/tests/models/TagTemplate.php new file mode 100644 index 000000000..9ecc7c9e3 --- /dev/null +++ b/tests/models/TagTemplate.php @@ -0,0 +1,14 @@ +hasColumn('name', 'string', 100); + $this->hasColumn('description', 'string'); + } + + public function setUp() + { + //$this->hasOne('[Component]', array('onDelete' => 'CASCADE')); + } +} diff --git a/tests/models/Taggable.php b/tests/models/Taggable.php new file mode 100644 index 000000000..98e6a6581 --- /dev/null +++ b/tests/models/Taggable.php @@ -0,0 +1,8 @@ +hasMany('[Component]TagTemplate as Tag'); + } +} diff --git a/tests/models/User.php b/tests/models/User.php index 9cd73295b..f093d0d08 100644 --- a/tests/models/User.php +++ b/tests/models/User.php @@ -2,10 +2,6 @@ require_once('Entity.php'); -// UserTable doesn't extend Doctrine_Table -> Doctrine_Connection -// won't initialize grouptable when Doctrine_Connection->getTable('User') is called -class UserTable extends Doctrine_Table { } - class User extends Entity { public function setUp() diff --git a/tests/models/UserTable.php b/tests/models/UserTable.php new file mode 100644 index 000000000..3f5e84710 --- /dev/null +++ b/tests/models/UserTable.php @@ -0,0 +1,5 @@ + Doctrine_Connection +// won't initialize grouptable when Doctrine_Connection->getTable('User') is called +class UserTable extends Doctrine_Table { } diff --git a/tests/models/VersioningTest.php b/tests/models/VersioningTest.php index 8219d1bcf..7cb60d492 100644 --- a/tests/models/VersioningTest.php +++ b/tests/models/VersioningTest.php @@ -11,32 +11,3 @@ public function setUp() $this->actAs('Versionable'); } } - -class VersioningTest2 extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('name', 'string'); - $this->hasColumn('version', 'integer'); - } - public function setUp() - { - $this->actAs('Versionable', array('auditLog' => false)); - } -} - -class VersioningTest3 extends Doctrine_Record -{ - public function setTableDefinition() - { - $this->hasColumn('name', 'string'); - $this->hasColumn('version', 'integer'); - } - public function setUp() - { - - $this->actAs('Versionable', array('tableName' => 'tbl_prefix_comments_version', - 'className' => 'VersioningTestClass')); - - } -} \ No newline at end of file diff --git a/tests/models/VersioningTest2.php b/tests/models/VersioningTest2.php new file mode 100644 index 000000000..c48e9de31 --- /dev/null +++ b/tests/models/VersioningTest2.php @@ -0,0 +1,13 @@ +hasColumn('name', 'string'); + $this->hasColumn('version', 'integer'); + } + public function setUp() + { + $this->actAs('Versionable', array('auditLog' => false)); + } +} diff --git a/tests/models/VersioningTest3.php b/tests/models/VersioningTest3.php new file mode 100644 index 000000000..dd6a30403 --- /dev/null +++ b/tests/models/VersioningTest3.php @@ -0,0 +1,17 @@ +hasColumn('name', 'string'); + $this->hasColumn('version', 'integer'); + } + public function setUp() + { + $this->actAs('Versionable', array( + 'tableName' => 'tbl_prefix_comments_version', + 'className' => 'VersioningTestClass' + )); + } +}