From 2ddfc0726a53b461b1bfe455b43d8268d1af4a2e Mon Sep 17 00:00:00 2001 From: zYne Date: Tue, 12 Jun 2007 19:42:27 +0000 Subject: [PATCH] --- tests/Doctrine_Ticket343_TestCase.php | 107 ---------------------- tests/Export/PgsqlTestCase.php | 2 +- tests/ExportTestCase.php | 2 +- tests/Query/IdentifierQuotingTestCase.php | 4 +- tests/Ticket343TestCase.php | 19 ++-- 5 files changed, 10 insertions(+), 124 deletions(-) delete mode 100644 tests/Doctrine_Ticket343_TestCase.php diff --git a/tests/Doctrine_Ticket343_TestCase.php b/tests/Doctrine_Ticket343_TestCase.php deleted file mode 100644 index 6c8da6ae6..000000000 --- a/tests/Doctrine_Ticket343_TestCase.php +++ /dev/null @@ -1,107 +0,0 @@ -setTableName('members'); - - $this->hasColumn('pin', 'string', 8, array('primary'=>true, )); - $this->hasColumn('name', 'string', 254, array('notblank'=>true, )); - } - - public function setUp() - { - $this->hasMany('NewsBlast as news_blasts', 'NewsBlast.pin'); - } - -} - - -class NewsBlast extends Doctrine_Record -{ - const DATABASE_NAME = 'doctrine'; - - public function setTableDefinition() - { - $this->setTableName('p2m_newsblast'); - $this->hasColumn('subprogram_id', 'integer', 10, array()); - $this->hasColumn('title', 'string', 254, array()); - } - - public function setUp() - { - $this->hasOne('SubProgram as subprogram', 'NewsBlast.subprogram_id', 'id'); - $this->hasOne('Member as member', 'NewsBlast.pin', 'pin'); - } - -} - - -class SubProgram extends Doctrine_Record -{ - const DATABASE_NAME = 'doctrine'; - - public function setTableDefinition() - { - $this->setTableName('p2m_subprogram'); - $this->hasColumn('name', 'string', 50, array()); - } - - public function setUp() - { - $this->hasMany('Member as members', 'Member.subprogram_id'); - } -} - - - -class Doctrine_Ticket343_TestCase extends Doctrine_UnitTestCase -{ - public function prepareData() - { } - public function prepareTables() - { } - public function testForeignPkNonId() - { - - die('happy!'); - - $member = new Member(); - $subprogram = new SubProgram(); - $newsblast = new NewsBlast(); - - $member->set('name','hello world!'); - $member->set('pin', 'demo1100'); - - $subprogram->set('name', 'SoemthingNew'); - - $newsblast->set('pin', $member); - $newsblast->set('subprogram', $subprogram); - $newsblast->set('title', 'Some title here'); - - $newsblast->save(); - - $test->assertEqual($newsblast['subprogram'], 'SomethingNew'); - $test->assertEqual($newsblast['member']['pin'], 'demo1100'); - $test->assertEqual($newsblast['member']['name'], 'hello world!'); - $test->assertEqual(0,1); - - } -} diff --git a/tests/Export/PgsqlTestCase.php b/tests/Export/PgsqlTestCase.php index 5ad4a642f..e030f1426 100644 --- a/tests/Export/PgsqlTestCase.php +++ b/tests/Export/PgsqlTestCase.php @@ -77,7 +77,7 @@ 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))'); } - public function testExportSql() + public function testExportSql() { $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))', diff --git a/tests/ExportTestCase.php b/tests/ExportTestCase.php index 634d40dd0..0c9af1d90 100644 --- a/tests/ExportTestCase.php +++ b/tests/ExportTestCase.php @@ -83,7 +83,7 @@ class Doctrine_Export_TestCase extends Doctrine_UnitTestCase } public function testExport() { - + } } ?> diff --git a/tests/Query/IdentifierQuotingTestCase.php b/tests/Query/IdentifierQuotingTestCase.php index 1620d1e6a..3207031df 100644 --- a/tests/Query/IdentifierQuotingTestCase.php +++ b/tests/Query/IdentifierQuotingTestCase.php @@ -37,7 +37,7 @@ class Doctrine_Query_IdentifierQuoting_TestCase extends Doctrine_UnitTestCase { public function prepareTables() { } public function prepareData() { } public function testQuerySupportsIdentifierQuoting() { - $this->connection->setAttribute(Doctrine::ATTR_QUOTE_IDENTIFIER, true); + $this->conn->setAttribute(Doctrine::ATTR_QUOTE_IDENTIFIER, true); $q = new Doctrine_Query(); @@ -61,6 +61,6 @@ class Doctrine_Query_IdentifierQuoting_TestCase extends Doctrine_UnitTestCase { $this->assertEqual($q->getQuery(), 'SELECT e.id AS e__id, e.name AS e__name FROM "entity" e INNER JOIN "phonenumber" p ON e.id = p.entity_id WHERE e.id IN (SELECT DISTINCT e2.id FROM "entity" e2 INNER JOIN "phonenumber" p2 ON e2.id = p2.entity_id WHERE (e2.type = 0) LIMIT 5) AND (e.type = 0)'); - $this->connection->setAttribute(Doctrine::ATTR_QUOTE_IDENTIFIER, false); + $this->conn->setAttribute(Doctrine::ATTR_QUOTE_IDENTIFIER, false); } } diff --git a/tests/Ticket343TestCase.php b/tests/Ticket343TestCase.php index 6d22b8147..1807b9c09 100644 --- a/tests/Ticket343TestCase.php +++ b/tests/Ticket343TestCase.php @@ -48,7 +48,7 @@ class Doctrine_Ticket343_TestCase extends Doctrine_UnitTestCase $subprogram->set('name', 'SoemthingNew'); - $newsblast->set('pin', $member); + $newsblast->set('member', $member); $newsblast->set('subprogram', $subprogram); $newsblast->set('title', 'Some title here'); @@ -57,22 +57,18 @@ class Doctrine_Ticket343_TestCase extends Doctrine_UnitTestCase $test->assertEqual($newsblast['subprogram'], 'SomethingNew'); $test->assertEqual($newsblast['member']['pin'], 'demo1100'); $test->assertEqual($newsblast['member']['name'], 'hello world!'); - $test->assertEqual(0,1); - } } class Member extends Doctrine_Record { - const DATABASE_NAME = 'doctrine'; - public function setTableDefinition() { $this->setTableName('members'); - $this->hasColumn('pin', 'string', 8, array('primary'=>true, )); - $this->hasColumn('name', 'string', 254, array('notblank'=>true, )); + $this->hasColumn('pin', 'string', 8, array('primary' => true)); + $this->hasColumn('name', 'string', 254, array('notblank' => true)); } public function setUp() @@ -84,25 +80,22 @@ class Member extends Doctrine_Record class NewsBlast extends Doctrine_Record { - const DATABASE_NAME = 'doctrine'; - public function setTableDefinition() { $this->setTableName('p2m_newsblast'); + $this->hasColumn('pin', 'string', 8, array('primary' => true)); $this->hasColumn('subprogram_id', 'integer', 10, array()); $this->hasColumn('title', 'string', 254, array()); } public function setUp() { - $this->hasOne('SubProgram as subprogram', 'NewsBlast.subprogram_id', 'id'); - $this->hasOne('Member as member', 'NewsBlast.pin', 'pin'); + $this->hasOne('SubProgram as subprogram', 'NewsBlast.subprogram_id'); + $this->hasOne('Member as member', 'NewsBlast.pin'); } } class SubProgram extends Doctrine_Record { - const DATABASE_NAME = 'doctrine'; - public function setTableDefinition() { $this->setTableName('p2m_subprogram');