1
0
mirror of synced 2025-01-18 06:21:40 +03:00

removing ending ?> and some tabs

This commit is contained in:
meus 2007-09-02 16:56:44 +00:00
parent eb92f6d220
commit d08f492656
49 changed files with 217 additions and 269 deletions

View File

@ -123,4 +123,3 @@ class Doctrine_Access_TestCase extends Doctrine_UnitTestCase
$this->assertEqual($user->get('name'), 'Jack'); $this->assertEqual($user->get('name'), 'Jack');
} }
} }
?>

View File

@ -85,4 +85,3 @@ class Doctrine_BatchIterator_TestCase extends Doctrine_UnitTestCase {
} }
} }
?>

View File

@ -57,4 +57,3 @@ class Doctrine_Cache_FileTestCase extends Doctrine_UnitTestCase {
} }
} }
?>

View File

@ -37,4 +37,3 @@ class Doctrine_Cache_Query_SqliteTestCase extends Doctrine_UnitTestCase {
$this->assertEqual($this->cache->count(), 0); $this->assertEqual($this->cache->count(), 0);
} }
} }
?>

View File

@ -107,4 +107,3 @@ class Doctrine_Cache_SqliteTestCase extends Doctrine_UnitTestCase {
} }
} }
?>

View File

@ -74,4 +74,3 @@ class Doctrine_Collection_Offset_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($coll[6]->getState(), Doctrine_Record::STATE_CLEAN); $this->assertEqual($coll[6]->getState(), Doctrine_Record::STATE_CLEAN);
} }
} }
?>

View File

@ -330,4 +330,3 @@ class Doctrine_Collection_TestCase extends Doctrine_UnitTestCase
} }
} }
?>

View File

@ -11,4 +11,3 @@ class Doctrine_Composite_PrimaryKey_TestCase extends Doctrine_UnitTestCase {
parent::prepareTables(); parent::prepareTables();
} }
} }
?>

View File

@ -215,4 +215,3 @@ class Doctrine_Configurable_TestCase extends Doctrine_UnitTestCase {
$this->assertTrue(is_array($this->manager->getAttributes())); $this->assertTrue(is_array($this->manager->getAttributes()));
} }
} }
?>

View File

@ -181,4 +181,3 @@ class Doctrine_Connection_Profiler_TestCase extends Doctrine_UnitTestCase
$this->assertTrue(is_numeric($this->profiler->lastEvent()->getElapsedSecs())); $this->assertTrue(is_numeric($this->profiler->lastEvent()->getElapsedSecs()));
} }
} }
?>

View File

@ -232,4 +232,3 @@ class Doctrine_Connection_TestCase extends Doctrine_UnitTestCase
$this->assertEqual($this->connection->transaction->getTransactionLevel(),0); $this->assertEqual($this->connection->transaction->getTransactionLevel(),0);
} }
} }
?>

View File

@ -180,4 +180,3 @@ class Doctrine_Connection_Transaction_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($listener->pop(), 'onPreTransactionCommit'); $this->assertEqual($listener->pop(), 'onPreTransactionCommit');
} }
} }
?>

View File

@ -58,4 +58,3 @@ class Doctrine_CustomPrimaryKey_TestCase extends Doctrine_UnitTestCase
$this->assertEqual($c->identifier(), array('uid' => 1)); $this->assertEqual($c->identifier(), array('uid' => 1));
} }
} }
?>

View File

@ -177,4 +177,3 @@ class Doctrine_CustomResultSetOrder_TestCase extends Doctrine_UnitTestCase {
} }
} }
} }
?>

View File

@ -61,4 +61,3 @@ class Doctrine_DataDict_Sqlite_TestCase extends Doctrine_UnitTestCase {
} }
} }
*/ */
?>

View File

@ -116,4 +116,3 @@ class Doctrine_DataType_Boolean_TestCase extends Doctrine_UnitTestCase {
} }
} }
?>

View File

@ -200,4 +200,3 @@ class Doctrine_DataType_Enum_TestCase extends Doctrine_UnitTestCase
$this->assertEqual($q->getQuery(), "SELECT e.id AS e__id, e.status AS e__status, e.text AS e__text, e2.text AS e2__text FROM enum_test e LEFT JOIN enum_test3 e2 ON e.text = e2.text WHERE e.status = 1"); $this->assertEqual($q->getQuery(), "SELECT e.id AS e__id, e.status AS e__status, e.text AS e__text, e2.text AS e2__text FROM enum_test e LEFT JOIN enum_test3 e2 ON e.text = e2.text WHERE e.status = 1");
} }
} }
?>

View File

@ -174,4 +174,3 @@ class Doctrine_Connection_Profiler_TestCase extends Doctrine_UnitTestCase
$this->assertTrue(is_numeric($this->profiler->lastEvent()->getElapsedSecs())); $this->assertTrue(is_numeric($this->profiler->lastEvent()->getElapsedSecs()));
} }
} }
?>

View File

@ -135,4 +135,3 @@ class Doctrine_Db_Profiler_TestCase extends Doctrine_UnitTestCase {
$this->assertTrue(is_numeric($this->profiler->lastEvent()->getElapsedSecs())); $this->assertTrue(is_numeric($this->profiler->lastEvent()->getElapsedSecs()));
} }
} }
?>

View File

@ -197,4 +197,3 @@ class Doctrine_Driver_UnitTestCase extends UnitTestCase {
} }
} }
} }
?>

View File

@ -90,4 +90,3 @@ class Doctrine_Export_Firebird_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))');
} }
} }
?>

View File

@ -151,4 +151,3 @@ class Doctrine_Export_Oracle_TestCase extends Doctrine_UnitTestCase
$this->assertEqual($sql[0], 'CREATE TABLE sometable (id INT UNIQUE, name VARCHAR2(4), PRIMARY KEY(id), INDEX myindex (id, name))'); $this->assertEqual($sql[0], 'CREATE TABLE sometable (id INT UNIQUE, name VARCHAR2(4), PRIMARY KEY(id), INDEX myindex (id, name))');
} }
} }
?>

View File

@ -96,4 +96,3 @@ class Doctrine_Export_Pgsql_TestCase extends Doctrine_UnitTestCase
)); ));
} }
} }
?>

View File

@ -152,4 +152,3 @@ class Doctrine_Export_Sqlite_TestCase extends Doctrine_UnitTestCase
} }
*/ */
} }
?>

View File

@ -86,4 +86,3 @@ class Doctrine_Export_TestCase extends Doctrine_UnitTestCase
} }
} }
?>

View File

@ -170,4 +170,3 @@ class Doctrine_Hook_TestCase extends Doctrine_UnitTestCase
} }
} }
?>

View File

@ -59,4 +59,3 @@ class Doctrine_Manager_TestCase extends Doctrine_UnitTestCase {
public function prepareData() { } public function prepareData() { }
public function prepareTables() { } public function prepareTables() { }
} }
?>

View File

@ -216,4 +216,3 @@ class Doctrine_Query_AggregateValue_TestCase extends Doctrine_UnitTestCase
} }
?>

View File

@ -121,4 +121,3 @@ class Doctrine_Query_ComponentAlias_TestCase extends Doctrine_UnitTestCase
} }
} }
?>

View File

@ -118,4 +118,3 @@ class Doctrine_Query_Condition_TestCase extends Doctrine_UnitTestCase
$this->assertEqual($query->getQuery(), $sql); $this->assertEqual($query->getQuery(), $sql);
} }
} }
?>

View File

@ -104,4 +104,3 @@ class Doctrine_Query_Delete_TestCase extends Doctrine_UnitTestCase
$this->assertEqual($q->getQuery(), 'DELETE FROM entity LIMIT 10 OFFSET 20'); $this->assertEqual($q->getQuery(), 'DELETE FROM entity LIMIT 10 OFFSET 20');
} }
} }
?>

View File

@ -117,4 +117,3 @@ class Doctrine_Query_From_TestCase extends Doctrine_UnitTestCase
$this->assertEqual($q->getQuery(), "SELECT e.id AS e__id, e.name AS e__name, p.id AS p__id, p.phonenumber AS p__phonenumber FROM entity e INNER JOIN groupuser g ON e.id = g.user_id INNER JOIN entity e2 ON e2.id = g.group_id LEFT JOIN phonenumber p ON e2.id = p.entity_id WHERE (e.type = 0 AND (e2.type = 1 OR e2.type IS NULL))"); $this->assertEqual($q->getQuery(), "SELECT e.id AS e__id, e.name AS e__name, p.id AS p__id, p.phonenumber AS p__phonenumber FROM entity e INNER JOIN groupuser g ON e.id = g.user_id INNER JOIN entity e2 ON e2.id = g.group_id LEFT JOIN phonenumber p ON e2.id = p.entity_id WHERE (e.type = 0 AND (e2.type = 1 OR e2.type IS NULL))");
} }
} }
?>

View File

@ -302,4 +302,3 @@ class Doctrine_Query_Limit_TestCase extends Doctrine_UnitTestCase
$this->assertEqual($q->getSql(), "SELECT p.id AS p__id, p.name AS p__name, t.id AS t__id, t.tag AS t__tag FROM photo p LEFT JOIN phototag p2 ON p.id = p2.photo_id LEFT JOIN tag t ON t.id = p2.tag_id WHERE p.id IN (SELECT DISTINCT p3.id FROM photo p3 LEFT JOIN phototag p4 ON p3.id = p4.photo_id LEFT JOIN tag t2 ON t2.id = p4.tag_id ORDER BY t2.id DESC LIMIT 10) ORDER BY t.id DESC"); $this->assertEqual($q->getSql(), "SELECT p.id AS p__id, p.name AS p__name, t.id AS t__id, t.tag AS t__tag FROM photo p LEFT JOIN phototag p2 ON p.id = p2.photo_id LEFT JOIN tag t ON t.id = p2.tag_id WHERE p.id IN (SELECT DISTINCT p3.id FROM photo p3 LEFT JOIN phototag p4 ON p3.id = p4.photo_id LEFT JOIN tag t2 ON t2.id = p4.tag_id ORDER BY t2.id DESC LIMIT 10) ORDER BY t.id DESC");
} }
} }
?>

View File

@ -200,4 +200,3 @@ class Doctrine_Query_ReferenceModel_TestCase extends Doctrine_UnitTestCase {
} }
*/ */
} }
?>

View File

@ -231,4 +231,3 @@ class Doctrine_Query_Select_TestCase extends Doctrine_UnitTestCase
$this->assertEqual($users[4]->Phonenumber[0]->max, '444 555'); $this->assertEqual($users[4]->Phonenumber[0]->max, '444 555');
} }
} }
?>

View File

@ -109,23 +109,22 @@ class Doctrine_Query_Subquery_TestCase extends Doctrine_UnitTestCase
} }
public function testAggregateFunctionsInOrderByAndHavingWithCount() public function testAggregateFunctionsInOrderByAndHavingWithCount()
{ {
$q = new Doctrine_Query(); $q = new Doctrine_Query();
$q->select('u.*, COUNT(a.id) num_albums') $q->select('u.*, COUNT(a.id) num_albums')
->from('User u') ->from('User u')
->leftJoin('u.Album a') ->leftJoin('u.Album a')
->orderby('num_albums desc') ->orderby('num_albums desc')
->groupby('u.id') ->groupby('u.id')
->having('num_albums > 0') ->having('num_albums > 0')
->limit(5); ->limit(5);
try { try {
$q->count(); $q->count();
$this->pass(); $this->pass();
} catch (Doctrine_Exception $e) { } catch (Doctrine_Exception $e) {
$this->fail(); $this->fail();
} }
} }
} }
?>

View File

@ -81,4 +81,3 @@ class Doctrine_Query_Update_TestCase extends Doctrine_UnitTestCase
$this->assertEqual($q->getQuery(), "UPDATE entity SET id = id + 1 WHERE (type = 0)"); $this->assertEqual($q->getQuery(), "UPDATE entity SET id = id + 1 WHERE (type = 0)");
} }
} }
?>

View File

@ -249,4 +249,3 @@ class Doctrine_RawSql_TestCase extends Doctrine_UnitTestCase
$this->assertEqual(count($coll), 3); $this->assertEqual(count($coll), 3);
} }
} }
?>

View File

@ -43,4 +43,3 @@ class Doctrine_Record_Filter_TestCase extends Doctrine_UnitTestCase {
} }
} }
?>

View File

@ -47,7 +47,7 @@ class Doctrine_Record_TestCase extends Doctrine_UnitTestCase
{ {
$user = new User(); $user = new User();
$user->name = "Richard Linklater"; $user->name = "Richard Linklater";
$rel = $user->getTable()->getRelation('Account'); $rel = $user->getTable()->getRelation('Account');
$this->assertTrue($rel instanceof Doctrine_Relation_ForeignKey); $this->assertTrue($rel instanceof Doctrine_Relation_ForeignKey);
@ -148,7 +148,7 @@ class Doctrine_Record_TestCase extends Doctrine_UnitTestCase
$this->connection->clear(); $this->connection->clear();
$gzip = $gzip->getTable()->find($gzip->id); $gzip = $gzip->getTable()->find($gzip->id);
$this->assertEqual($gzip->gzip, "compressed"); $this->assertEqual($gzip->gzip, "compressed");
$gzip->gzip = "compressed 2"; $gzip->gzip = "compressed 2";
$this->assertEqual($gzip->gzip, "compressed 2"); $this->assertEqual($gzip->gzip, "compressed 2");
@ -162,7 +162,7 @@ class Doctrine_Record_TestCase extends Doctrine_UnitTestCase
{ {
$test = new FieldNameTest; $test = new FieldNameTest;
$this->assertEqual($test->someColumn, 'some string'); $this->assertEqual($test->someColumn, 'some string');
$this->assertEqual($test->someEnum, 'php'); $this->assertEqual($test->someEnum, 'php');
$this->assertEqual($test->someArray, array()); $this->assertEqual($test->someArray, array());
@ -174,12 +174,12 @@ class Doctrine_Record_TestCase extends Doctrine_UnitTestCase
public function testToArray() public function testToArray()
{ {
$user = new User(); $user = new User();
$a = $user->toArray(); $a = $user->toArray();
$this->assertTrue(is_array($a)); $this->assertTrue(is_array($a));
$this->assertTrue(array_key_exists('name', $a)); $this->assertTrue(array_key_exists('name', $a));
$this->assertEqual($a['name'], null); $this->assertEqual($a['name'], null);
$this->assertTrue(array_key_exists('id', $a)); $this->assertTrue(array_key_exists('id', $a));
@ -196,7 +196,7 @@ class Doctrine_Record_TestCase extends Doctrine_UnitTestCase
$this->assertEqual($a['name'], 'Someone'); $this->assertEqual($a['name'], 'Someone');
$this->assertTrue(array_key_exists('id', $a)); $this->assertTrue(array_key_exists('id', $a));
$this->assertTrue(is_numeric($a['id'])); $this->assertTrue(is_numeric($a['id']));
$user->refresh(); $user->refresh();
$a = $user->toArray(); $a = $user->toArray();
@ -290,7 +290,7 @@ class Doctrine_Record_TestCase extends Doctrine_UnitTestCase
$this->assertEqual($record->entity1, 3); $this->assertEqual($record->entity1, 3);
$this->assertEqual($record->identifier(), array("entity1" => 3, "entity2" => 4)); $this->assertEqual($record->identifier(), array("entity1" => 3, "entity2" => 4));
$record->entity2 = 5; $record->entity2 = 5;
$record->entity1 = 2; $record->entity1 = 2;
$this->assertEqual($record->state(), Doctrine_Record::STATE_DIRTY); $this->assertEqual($record->state(), Doctrine_Record::STATE_DIRTY);
@ -309,7 +309,7 @@ class Doctrine_Record_TestCase extends Doctrine_UnitTestCase
$this->assertEqual($record->entity2, 5); $this->assertEqual($record->entity2, 5);
$this->assertEqual($record->entity1, 2); $this->assertEqual($record->entity1, 2);
$this->assertEqual($record->identifier(), array("entity1" => 2, "entity2" => 5)); $this->assertEqual($record->identifier(), array("entity1" => 2, "entity2" => 5));
$record->refresh(); $record->refresh();
$this->assertEqual($record->state(), Doctrine_Record::STATE_CLEAN); $this->assertEqual($record->state(), Doctrine_Record::STATE_CLEAN);
$this->assertEqual($record->entity2, 5); $this->assertEqual($record->entity2, 5);
@ -320,7 +320,7 @@ class Doctrine_Record_TestCase extends Doctrine_UnitTestCase
$record->entity2 = 6; $record->entity2 = 6;
$record->entity1 = 2; $record->entity1 = 2;
$record->save(); $record->save();
$coll = $this->connection->query("FROM EntityReference"); $coll = $this->connection->query("FROM EntityReference");
$this->assertTrue($coll[0] instanceof EntityReference); $this->assertTrue($coll[0] instanceof EntityReference);
$this->assertEqual($coll[0]->state(), Doctrine_Record::STATE_CLEAN); $this->assertEqual($coll[0]->state(), Doctrine_Record::STATE_CLEAN);
@ -417,7 +417,7 @@ class Doctrine_Record_TestCase extends Doctrine_UnitTestCase
$this->assertEqual($fk->getType(), Doctrine_Relation::MANY_AGGREGATE); $this->assertEqual($fk->getType(), Doctrine_Relation::MANY_AGGREGATE);
$this->assertEqual($fk->getForeign(), "parent_id"); $this->assertEqual($fk->getForeign(), "parent_id");
$this->assertEqual($fk->getLocal(), "id"); $this->assertEqual($fk->getLocal(), "id");
$e->name = "parent"; $e->name = "parent";
@ -480,7 +480,7 @@ class Doctrine_Record_TestCase extends Doctrine_UnitTestCase
$this->assertEqual($e2->code,2); $this->assertEqual($e2->code,2);
$this->assertEqual($e2->file_md5, md5(1)); $this->assertEqual($e2->file_md5, md5(1));
$this->assertEqual($e2->message, 'user error2'); $this->assertEqual($e2->message, 'user error2');
$fk = $e->getTable()->getRelation('Description'); $fk = $e->getTable()->getRelation('Description');
$this->assertTrue($fk instanceof Doctrine_Relation_ForeignKey); $this->assertTrue($fk instanceof Doctrine_Relation_ForeignKey);
@ -501,7 +501,7 @@ class Doctrine_Record_TestCase extends Doctrine_UnitTestCase
$this->assertEqual($e2->Description[1]->file_md5, $e2->file_md5); $this->assertEqual($e2->Description[1]->file_md5, $e2->file_md5);
$e->save(); $e->save();
$coll = $this->connection->query('FROM Error'); $coll = $this->connection->query('FROM Error');
$e = $coll[0]; $e = $coll[0];
@ -518,7 +518,7 @@ class Doctrine_Record_TestCase extends Doctrine_UnitTestCase
$this->assertEqual($e->Description[1]->description, 'This is the 2nd description'); $this->assertEqual($e->Description[1]->description, 'This is the 2nd description');
// UPDATING // UPDATING
$e->code = 2; $e->code = 2;
$e->message = 'changed message'; $e->message = 'changed message';
$e->Description[0]->description = '1st changed description'; $e->Description[0]->description = '1st changed description';
@ -542,9 +542,9 @@ class Doctrine_Record_TestCase extends Doctrine_UnitTestCase
$user = new User(); $user = new User();
$user->name = "John Locke"; $user->name = "John Locke";
$user->save(); $user->save();
$this->assertTrue(is_numeric($user->id) && $user->id > 0); $this->assertTrue(is_numeric($user->id) && $user->id > 0);
$this->assertTrue($user->getModified() == array()); $this->assertTrue($user->getModified() == array());
$this->assertTrue($user->state() == Doctrine_Record::STATE_CLEAN); $this->assertTrue($user->state() == Doctrine_Record::STATE_CLEAN);
@ -720,7 +720,7 @@ class Doctrine_Record_TestCase extends Doctrine_UnitTestCase
$user = $this->objTable->find(5); $user = $this->objTable->find(5);
$this->assertTrue($user->Email instanceof Email); $this->assertTrue($user->Email instanceof Email);
$this->assertEqual($user->Email->address, "absolutist@nottodrink.com"); $this->assertEqual($user->Email->address, "absolutist@nottodrink.com");
$emails = $this->connection->query("FROM Email WHERE Email.id = $id"); $emails = $this->connection->query("FROM Email WHERE Email.id = $id");
//$this->assertEqual(count($emails),0); //$this->assertEqual(count($emails),0);
@ -822,7 +822,7 @@ class Doctrine_Record_TestCase extends Doctrine_UnitTestCase
$this->assertEqual($user->Group->count(), 0); $this->assertEqual($user->Group->count(), 0);
$user = $this->objTable->find(5); $user = $this->objTable->find(5);
$this->assertEqual($user->Group->count(), 0); $this->assertEqual($user->Group->count(), 0);
// ACCESSING ASSOCIATION OBJECT PROPERTIES // ACCESSING ASSOCIATION OBJECT PROPERTIES
@ -831,7 +831,7 @@ class Doctrine_Record_TestCase extends Doctrine_UnitTestCase
$this->assertTrue($user->Groupuser instanceof Doctrine_Collection); $this->assertTrue($user->Groupuser instanceof Doctrine_Collection);
$this->assertTrue($user->Groupuser[0] instanceof Groupuser); $this->assertTrue($user->Groupuser[0] instanceof Groupuser);
$user->name = "Jack Daniels"; $user->name = "Jack Daniels";
$user->Group[0]->name = "Group #1"; $user->Group[0]->name = "Group #1";
$user->Group[1]->name = "Group #2"; $user->Group[1]->name = "Group #2";
@ -839,10 +839,10 @@ class Doctrine_Record_TestCase extends Doctrine_UnitTestCase
$t2 = time(); $t2 = time();
$user->Groupuser[0]->added = $t1; $user->Groupuser[0]->added = $t1;
$user->Groupuser[1]->added = $t2; $user->Groupuser[1]->added = $t2;
$this->assertEqual($user->Groupuser[0]->added, $t1); $this->assertEqual($user->Groupuser[0]->added, $t1);
$this->assertEqual($user->Groupuser[1]->added, $t2); $this->assertEqual($user->Groupuser[1]->added, $t2);
$user->save(); $user->save();
$user->refresh(); $user->refresh();
@ -874,21 +874,20 @@ class Doctrine_Record_TestCase extends Doctrine_UnitTestCase
$user = $this->connection->getTable("User")->find(4); $user = $this->connection->getTable("User")->find(4);
$this->assertTrue($user->getIterator() instanceof ArrayIterator); $this->assertTrue($user->getIterator() instanceof ArrayIterator);
} }
public function testRefreshRelated() public function testRefreshRelated()
{ {
$user = $this->connection->getTable("User")->find(4); $user = $this->connection->getTable("User")->find(4);
$user->Address[0]->address = "Address #1"; $user->Address[0]->address = "Address #1";
$user->Address[1]->address = "Address #2"; $user->Address[1]->address = "Address #2";
$user->save(); $user->save();
$this->assertEqual(count($user->Address), 2); $this->assertEqual(count($user->Address), 2);
Doctrine_Query::create()->delete()->from('EntityAddress')->where('user_id = ? AND address_id = ?', array($user->id, $user->Address[1]->id))->execute(); Doctrine_Query::create()->delete()->from('EntityAddress')->where('user_id = ? AND address_id = ?', array($user->id, $user->Address[1]->id))->execute();
$user->refreshRelated('Address'); $user->refreshRelated('Address');
$this->assertEqual(count($user->Address), 1); $this->assertEqual(count($user->Address), 1);
Doctrine_Query::create()->delete()->from('EntityAddress')->where('user_id = ? AND address_id = ?', array($user->id, $user->Address[0]->id))->execute(); Doctrine_Query::create()->delete()->from('EntityAddress')->where('user_id = ? AND address_id = ?', array($user->id, $user->Address[0]->id))->execute();
$user->refreshRelated(); $user->refreshRelated();
$this->assertEqual(count($user->Address), 0); $this->assertEqual(count($user->Address), 0);
} }
} }
?>

View File

@ -6,78 +6,78 @@ class Doctrine_Relation_Access_TestCase extends Doctrine_UnitTestCase {
$o2 = new File_Owner(); $o2 = new File_Owner();
$o2->name = "owner2"; $o2->name = "owner2";
$f1 = new Data_File(); $f1 = new Data_File();
$f1->filename = 'file1'; $f1->filename = 'file1';
$f2 = new Data_File(); $f2 = new Data_File();
$f2->filename = 'file2'; $f2->filename = 'file2';
$f3 = new Data_File(); $f3 = new Data_File();
$f3->filename = 'file3'; $f3->filename = 'file3';
$o1->Data_File->filename = 'file4'; $o1->Data_File->filename = 'file4';
// multiple left join branches test // multiple left join branches test
$us = array(); $us = array();
$us[1] = new MyUser(); $us[1] = new MyUser();
$us[1]->name = "user1"; $us[1]->name = "user1";
$this->connection->flush(); $this->connection->flush();
// OneThings // OneThings
$onethings_gs = array( $onethings_gs = array(
array(6,1) array(6,1)
); );
$count = 1; $count = 1;
foreach($onethings_gs as $onething_g) { foreach($onethings_gs as $onething_g) {
for($i=$count;$i<$count+$onething_g[0];$i++) { for($i=$count;$i<$count+$onething_g[0];$i++) {
$d = new MyOneThing(); $d = new MyOneThing();
$d->name = "onething".$i; $d->name = "onething".$i;
if($onething_g[1]) { if($onething_g[1]) {
$us[$onething_g[1]]->MyOneThing->add($d); $us[$onething_g[1]]->MyOneThing->add($d);
} }
} }
$count += $onething_g[0]; $count += $onething_g[0];
} }
// OtherThings // OtherThings
for($i=0;$i<6;$i++) { for($i=0;$i<6;$i++) {
$o = new MyOtherThing(); $o = new MyOtherThing();
$o->name = "otherthing".$i; $o->name = "otherthing".$i;
$us[1]->MyOtherThing->add($o); $us[1]->MyOtherThing->add($o);
} }
// UserOneThings // UserOneThings
/* Doctrine assigns the foreign keys automatically /* Doctrine assigns the foreign keys automatically
$one_id_gs = array( $one_id_gs = array(
array(array(2,3,6,5,1), 1) array(array(2,3,6,5,1), 1)
); );
foreach($one_id_gs as $one_ids) { foreach($one_id_gs as $one_ids) {
foreach($one_ids[0] as $oid) { foreach($one_ids[0] as $oid) {
$od = new MyUserOneThing(); $od = new MyUserOneThing();
$od->one_thing_id = $oid; $od->one_thing_id = $oid;
$od->user_id = $one_ids[1]; $od->user_id = $one_ids[1];
} }
} }
// UserOtherThings // UserOtherThings
$oth_id_gs = array( $oth_id_gs = array(
array(array(5,4), 1) array(array(5,4), 1)
); );
foreach($oth_id_gs as $oth_ids) { foreach($oth_id_gs as $oth_ids) {
foreach($oth_ids[0] as $oid) { foreach($oth_ids[0] as $oid) {
$uo = new MyUserOtherThing(); $uo = new MyUserOtherThing();
$uo->other_thing_id = $oid; $uo->other_thing_id = $oid;
$uo->user_id = $oth_ids[1]; $uo->user_id = $oth_ids[1];
} }
} }
*/ */
$this->connection->flush(); $this->connection->flush();
$this->connection->clear(); $this->connection->clear();
} }
public function prepareTables() { public function prepareTables() {
$this->tables += array("MyUser", $this->tables += array("MyUser",
"MyOneThing", "MyOneThing",
"MyUserOneThing", "MyUserOneThing",
"MyOtherThing", "MyOtherThing",
"MyUserOtherThing"); "MyUserOtherThing");
parent::prepareTables(); parent::prepareTables();
} }
public function testOneToOneAggregateRelationFetching() { public function testOneToOneAggregateRelationFetching() {
$coll = $this->connection->query("FROM File_Owner.Data_File WHERE File_Owner.name = 'owner1'"); $coll = $this->connection->query("FROM File_Owner.Data_File WHERE File_Owner.name = 'owner1'");
$this->assertTrue(count($coll) == 1); $this->assertTrue(count($coll) == 1);
@ -87,131 +87,129 @@ class Doctrine_Relation_Access_TestCase extends Doctrine_UnitTestCase {
} }
public function testAccessOneToOneFromForeignSide() { public function testAccessOneToOneFromForeignSide() {
$check = $this->connection->query("FROM File_Owner WHERE File_Owner.name = 'owner1'"); $check = $this->connection->query("FROM File_Owner WHERE File_Owner.name = 'owner1'");
$owner1 = $this->connection->query("FROM File_Owner.Data_File WHERE File_Owner.name = 'owner1'"); $owner1 = $this->connection->query("FROM File_Owner.Data_File WHERE File_Owner.name = 'owner1'");
$owner2 = $this->connection->query("FROM File_Owner.Data_File WHERE File_Owner.name = 'owner2'"); $owner2 = $this->connection->query("FROM File_Owner.Data_File WHERE File_Owner.name = 'owner2'");
$this->assertTrue(count($check) == 1); $this->assertTrue(count($check) == 1);
$this->assertTrue(count($owner2) == 1); $this->assertTrue(count($owner2) == 1);
$check = $check[0]; $check = $check[0];
$owner1 = $owner1[0]; $owner1 = $owner1[0];
$owner2 = $owner2[0]; $owner2 = $owner2[0];
$this->assertEqual($owner1->name, 'owner1'); $this->assertEqual($owner1->name, 'owner1');
$this->assertEqual($owner1->id, 1); $this->assertEqual($owner1->id, 1);
$check2 = $this->connection->query("FROM File_Owner WHERE File_Owner.id = ".$owner1->get('id')); $check2 = $this->connection->query("FROM File_Owner WHERE File_Owner.id = ".$owner1->get('id'));
$this->assertEqual(1, count($check2)); $this->assertEqual(1, count($check2));
$check2 = $check2[0]; $check2 = $check2[0];
$this->assertEqual('owner1', $check2->get('name')); $this->assertEqual('owner1', $check2->get('name'));
$this->assertTrue(isset($owner1->Data_File)); $this->assertTrue(isset($owner1->Data_File));
$this->assertFalse(isset($owner2->Data_File)); $this->assertFalse(isset($owner2->Data_File));
$this->assertEqual(1, $check->get('id')); $this->assertEqual(1, $check->get('id'));
$this->assertEqual(1, $owner1->get('id')); $this->assertEqual(1, $owner1->get('id'));
$this->assertEqual($owner1->get('id'), $check->get('id')); $this->assertEqual($owner1->get('id'), $check->get('id'));
$this->assertEqual(2, $owner2->get('id')); $this->assertEqual(2, $owner2->get('id'));
} }
public function testAccessOneToOneFromLocalSide() { public function testAccessOneToOneFromLocalSide() {
$check = $this->connection->query("FROM Data_File WHERE Data_File.filename = 'file4'"); $check = $this->connection->query("FROM Data_File WHERE Data_File.filename = 'file4'");
$file1 = $this->connection->query("FROM Data_File.File_Owner WHERE Data_File.filename = 'file4'"); $file1 = $this->connection->query("FROM Data_File.File_Owner WHERE Data_File.filename = 'file4'");
$file2 = $this->connection->query("FROM Data_File.File_Owner WHERE Data_File.filename = 'file1'"); $file2 = $this->connection->query("FROM Data_File.File_Owner WHERE Data_File.filename = 'file1'");
$this->assertTrue(count($check) == 1); $this->assertTrue(count($check) == 1);
$this->assertTrue(count($file1) == 1); $this->assertTrue(count($file1) == 1);
$this->assertTrue(count($file2) == 1); $this->assertTrue(count($file2) == 1);
$check = $check[0];
$file1 = $file1[0];
$file2 = $file2[0];
$check2 = $this->connection->query("FROM Data_File WHERE Data_File.id = ".$file1->get('id'));
$this->assertEqual(1, count($check2));
$check2 = $check2[0];
$this->assertEqual('file4', $check2->get('filename'));
$check = $check[0];
$file1 = $file1[0];
$file2 = $file2[0];
$check2 = $this->connection->query("FROM Data_File WHERE Data_File.id = ".$file1->get('id'));
$this->assertEqual(1, count($check2));
$check2 = $check2[0];
$this->assertEqual('file4', $check2->get('filename'));
$this->assertTrue(isset($file1->File_Owner)); $this->assertTrue(isset($file1->File_Owner));
$this->assertFalse(isset($file2->File_Owner)); $this->assertFalse(isset($file2->File_Owner));
$this->assertEqual(4, $check->get('id')); $this->assertEqual(4, $check->get('id'));
$this->assertEqual(4, $file1->get('id')); $this->assertEqual(4, $file1->get('id'));
$this->assertEqual($file1->get('id'), $check->get('id')); $this->assertEqual($file1->get('id'), $check->get('id'));
$this->assertEqual(1, $file2->get('id')); $this->assertEqual(1, $file2->get('id'));
} }
public function testMultipleLeftJoinBranches() { public function testMultipleLeftJoinBranches() {
$query = "FROM MyUserOtherThing"; $query = "FROM MyUserOtherThing";
$other = $this->connection->query($query); $other = $this->connection->query($query);
$check1 = array(); $check1 = array();
foreach($other as $oth) { foreach($other as $oth) {
if(!isset($check1[$oth->other_thing_id])) { if(!isset($check1[$oth->other_thing_id])) {
$check1[$oth->other_thing_id] = array(); $check1[$oth->other_thing_id] = array();
} }
$check1[$oth->other_thing_id][$oth->id] = $oth; $check1[$oth->other_thing_id][$oth->id] = $oth;
} }
$query = "FROM MyUserOneThing"; $query = "FROM MyUserOneThing";
$ones = $this->connection->query($query); $ones = $this->connection->query($query);
$check2 = array(); $check2 = array();
foreach($ones as $one) { foreach($ones as $one) {
if(!isset($check2[$one->one_thing_id])) { if(!isset($check2[$one->one_thing_id])) {
$check2[$one->one_thing_id] = array(); $check2[$one->one_thing_id] = array();
} }
$check2[$one->one_thing_id][$one->id] = $one; $check2[$one->one_thing_id][$one->id] = $one;
} }
$query = "FROM MyUser, $query = "FROM MyUser,
MyUser.MyOneThing, MyUser.MyOneThing,
MyUser.MyOneThing.MyUserOneThing, MyUser.MyOneThing.MyUserOneThing,
MyUser.MyOtherThing, MyUser.MyOtherThing,
MyUser.MyOtherThing.MyUserOtherThing"; MyUser.MyOtherThing.MyUserOtherThing";
$users = $this->connection->query($query); $users = $this->connection->query($query);
foreach($users as $u) { foreach($users as $u) {
$this->assertEqual($u->MyOtherThing->count(), 6, "incorrect count of MyOtherThing"); $this->assertEqual($u->MyOtherThing->count(), 6, "incorrect count of MyOtherThing");
foreach($u->MyOtherThing as $o) { foreach($u->MyOtherThing as $o) {
$in_check = array_key_exists($o->id, $check1); $in_check = array_key_exists($o->id, $check1);
$wanted_user_thing_count = $in_check ? count($check1[$o->id]) : 0; $wanted_user_thing_count = $in_check ? count($check1[$o->id]) : 0;
$this->assertEqual($o->MyUserOtherThing->count(), $wanted_user_thing_count, "incorrect count of MyUserOtherThing on MyOtherThing"); $this->assertEqual($o->MyUserOtherThing->count(), $wanted_user_thing_count, "incorrect count of MyUserOtherThing on MyOtherThing");
foreach($o->MyUserOtherThing as $uo) { foreach($o->MyUserOtherThing as $uo) {
$this->assertEqual($uo->other_thing_id, $o->id, "incorrectly assigned MyOtherThing.id on MyUserOtherThing"); $this->assertEqual($uo->other_thing_id, $o->id, "incorrectly assigned MyOtherThing.id on MyUserOtherThing");
if($in_check) { if($in_check) {
$wanted_user_thing_exists = array_key_exists($uo->id, $check1[$o->id]); $wanted_user_thing_exists = array_key_exists($uo->id, $check1[$o->id]);
$this->assertTrue($wanted_user_thing_exists, "MyUserOtherThing incorrectly assigned to MyOtherThing."); $this->assertTrue($wanted_user_thing_exists, "MyUserOtherThing incorrectly assigned to MyOtherThing.");
if($wanted_user_thing_exists) { if($wanted_user_thing_exists) {
$this->assertEqual($uo->other_thing_id, $check1[$o->id][$uo->id]->user_id, "incorrect value of MyUserOtherThing.user_id"); $this->assertEqual($uo->other_thing_id, $check1[$o->id][$uo->id]->user_id, "incorrect value of MyUserOtherThing.user_id");
$this->assertEqual($uo->other_thing_id, $check1[$o->id][$uo->id]->other_thing_id, "incorrect value of MyUserOtherThing.other_thing_id"); $this->assertEqual($uo->other_thing_id, $check1[$o->id][$uo->id]->other_thing_id, "incorrect value of MyUserOtherThing.other_thing_id");
} }
} }
} }
} }
} }
$query = "FROM MyUser, $query = "FROM MyUser,
MyUser.MyOtherThing, MyUser.MyOtherThing,
MyUser.MyOtherThing.MyUserOtherThing, MyUser.MyOtherThing.MyUserOtherThing,
MyUser.MyOneThing, MyUser.MyOneThing,
MyUser.MyOneThing.MyUserOneThing"; MyUser.MyOneThing.MyUserOneThing";
$users = $this->connection->query($query); $users = $this->connection->query($query);
foreach($users as $u) { foreach($users as $u) {
$this->assertEqual($u->MyOneThing->count(), 6, "incorrect count of MyOneThing"); $this->assertEqual($u->MyOneThing->count(), 6, "incorrect count of MyOneThing");
foreach($u->MyOneThing as $o) { foreach($u->MyOneThing as $o) {
$in_check = array_key_exists($o->id, $check2); $in_check = array_key_exists($o->id, $check2);
$wanted_user_thing_count = $in_check ? count($check2[$o->id]) : 0; $wanted_user_thing_count = $in_check ? count($check2[$o->id]) : 0;
$this->assertEqual($o->MyUserOneThing->count(), $wanted_user_thing_count, "incorrect count of MyUserOneThing on MyOneThing"); $this->assertEqual($o->MyUserOneThing->count(), $wanted_user_thing_count, "incorrect count of MyUserOneThing on MyOneThing");
foreach($o->MyUserOneThing as $uo) { foreach($o->MyUserOneThing as $uo) {
$this->assertEqual($uo->one_thing_id, $o->id, "incorrectly assigned MyOneThing.id on MyUserOneThing"); $this->assertEqual($uo->one_thing_id, $o->id, "incorrectly assigned MyOneThing.id on MyUserOneThing");
if($in_check) { if($in_check) {
$wanted_user_thing_exists = array_key_exists($uo->id, $check2[$o->id]); $wanted_user_thing_exists = array_key_exists($uo->id, $check2[$o->id]);
$this->assertTrue($wanted_user_thing_exists, "MyUserOneThing incorrectly assigned to MyOneThing."); $this->assertTrue($wanted_user_thing_exists, "MyUserOneThing incorrectly assigned to MyOneThing.");
if($wanted_user_thing_exists) { if($wanted_user_thing_exists) {
$this->assertEqual($uo->one_thing_id, $check2[$o->id][$uo->id]->user_id, "incorrect value of MyUserOneThing.user_id"); $this->assertEqual($uo->one_thing_id, $check2[$o->id][$uo->id]->user_id, "incorrect value of MyUserOneThing.user_id");
$this->assertEqual($uo->one_thing_id, $check2[$o->id][$uo->id]->one_thing_id, "incorrect value of MyUserOneThing.one_thing_id"); $this->assertEqual($uo->one_thing_id, $check2[$o->id][$uo->id]->one_thing_id, "incorrect value of MyUserOneThing.one_thing_id");
} }
} }
} }
} }
} }
} }
} }
?>

View File

@ -204,4 +204,3 @@ class Doctrine_Relation_ManyToMany_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($component->name, 'changed name'); $this->assertEqual($component->name, 'changed name');
} }
} }
?>

View File

@ -1,7 +1,5 @@
<?php <?php
class Doctrine_RepositoryTestCase extends Doctrine_UnitTestCase { class Doctrine_RepositoryTestCase extends Doctrine_UnitTestCase {
public function testAdd() { public function testAdd() {
} }
} }
?>

View File

@ -237,4 +237,3 @@ class Doctrine_Table_TestCase extends Doctrine_UnitTestCase
} }
} }
?>

View File

@ -84,4 +84,3 @@ class Doctrine_Ticket_Njero_TestCase extends Doctrine_UnitTestCase
#echo "Values " . serialize(array($c, $c2, $c3)); #echo "Values " . serialize(array($c, $c2, $c3));
} }
}?>

View File

@ -294,4 +294,3 @@ class Doctrine_UnitTestCase extends UnitTestCase
$this->init = true; $this->init = true;
} }
} }
?>

View File

@ -411,4 +411,3 @@ class Doctrine_Validator_TestCase extends Doctrine_UnitTestCase
$this->manager->setAttribute(Doctrine::ATTR_VLD, false); $this->manager->setAttribute(Doctrine::ATTR_VLD, false);
} }
} }
?>

View File

@ -58,4 +58,3 @@ class Doctrine_ValueHolder_TestCase extends Doctrine_UnitTestCase {
$this->assertTrue($f); $this->assertTrue($f);
} }
} }
?>

View File

@ -74,7 +74,5 @@ class Doctrine_View_TestCase extends Doctrine_UnitTestCase
public function testConstructor() public function testConstructor()
{ {
} }
} }
?>