removing ending ?> and some tabs
This commit is contained in:
parent
eb92f6d220
commit
d08f492656
@ -123,4 +123,3 @@ class Doctrine_Access_TestCase extends Doctrine_UnitTestCase
|
||||
$this->assertEqual($user->get('name'), 'Jack');
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -85,4 +85,3 @@ class Doctrine_BatchIterator_TestCase extends Doctrine_UnitTestCase {
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
@ -57,4 +57,3 @@ class Doctrine_Cache_FileTestCase extends Doctrine_UnitTestCase {
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
@ -37,4 +37,3 @@ class Doctrine_Cache_Query_SqliteTestCase extends Doctrine_UnitTestCase {
|
||||
$this->assertEqual($this->cache->count(), 0);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -107,4 +107,3 @@ class Doctrine_Cache_SqliteTestCase extends Doctrine_UnitTestCase {
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -74,4 +74,3 @@ class Doctrine_Collection_Offset_TestCase extends Doctrine_UnitTestCase {
|
||||
$this->assertEqual($coll[6]->getState(), Doctrine_Record::STATE_CLEAN);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -330,4 +330,3 @@ class Doctrine_Collection_TestCase extends Doctrine_UnitTestCase
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
@ -11,4 +11,3 @@ class Doctrine_Composite_PrimaryKey_TestCase extends Doctrine_UnitTestCase {
|
||||
parent::prepareTables();
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -215,4 +215,3 @@ class Doctrine_Configurable_TestCase extends Doctrine_UnitTestCase {
|
||||
$this->assertTrue(is_array($this->manager->getAttributes()));
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -181,4 +181,3 @@ class Doctrine_Connection_Profiler_TestCase extends Doctrine_UnitTestCase
|
||||
$this->assertTrue(is_numeric($this->profiler->lastEvent()->getElapsedSecs()));
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -232,4 +232,3 @@ class Doctrine_Connection_TestCase extends Doctrine_UnitTestCase
|
||||
$this->assertEqual($this->connection->transaction->getTransactionLevel(),0);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -180,4 +180,3 @@ class Doctrine_Connection_Transaction_TestCase extends Doctrine_UnitTestCase {
|
||||
$this->assertEqual($listener->pop(), 'onPreTransactionCommit');
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -58,4 +58,3 @@ class Doctrine_CustomPrimaryKey_TestCase extends Doctrine_UnitTestCase
|
||||
$this->assertEqual($c->identifier(), array('uid' => 1));
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -177,4 +177,3 @@ class Doctrine_CustomResultSetOrder_TestCase extends Doctrine_UnitTestCase {
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -61,4 +61,3 @@ class Doctrine_DataDict_Sqlite_TestCase extends Doctrine_UnitTestCase {
|
||||
}
|
||||
}
|
||||
*/
|
||||
?>
|
||||
|
@ -116,4 +116,3 @@ class Doctrine_DataType_Boolean_TestCase extends Doctrine_UnitTestCase {
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
@ -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");
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -174,4 +174,3 @@ class Doctrine_Connection_Profiler_TestCase extends Doctrine_UnitTestCase
|
||||
$this->assertTrue(is_numeric($this->profiler->lastEvent()->getElapsedSecs()));
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -135,4 +135,3 @@ class Doctrine_Db_Profiler_TestCase extends Doctrine_UnitTestCase {
|
||||
$this->assertTrue(is_numeric($this->profiler->lastEvent()->getElapsedSecs()));
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -197,4 +197,3 @@ class Doctrine_Driver_UnitTestCase extends UnitTestCase {
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -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))');
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -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))');
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -96,4 +96,3 @@ class Doctrine_Export_Pgsql_TestCase extends Doctrine_UnitTestCase
|
||||
));
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -152,4 +152,3 @@ class Doctrine_Export_Sqlite_TestCase extends Doctrine_UnitTestCase
|
||||
}
|
||||
*/
|
||||
}
|
||||
?>
|
||||
|
@ -86,4 +86,3 @@ class Doctrine_Export_TestCase extends Doctrine_UnitTestCase
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -170,4 +170,3 @@ class Doctrine_Hook_TestCase extends Doctrine_UnitTestCase
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
@ -59,4 +59,3 @@ class Doctrine_Manager_TestCase extends Doctrine_UnitTestCase {
|
||||
public function prepareData() { }
|
||||
public function prepareTables() { }
|
||||
}
|
||||
?>
|
||||
|
@ -216,4 +216,3 @@ class Doctrine_Query_AggregateValue_TestCase extends Doctrine_UnitTestCase
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
|
@ -121,4 +121,3 @@ class Doctrine_Query_ComponentAlias_TestCase extends Doctrine_UnitTestCase
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
@ -118,4 +118,3 @@ class Doctrine_Query_Condition_TestCase extends Doctrine_UnitTestCase
|
||||
$this->assertEqual($query->getQuery(), $sql);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -104,4 +104,3 @@ class Doctrine_Query_Delete_TestCase extends Doctrine_UnitTestCase
|
||||
$this->assertEqual($q->getQuery(), 'DELETE FROM entity LIMIT 10 OFFSET 20');
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -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))");
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -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");
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -200,4 +200,3 @@ class Doctrine_Query_ReferenceModel_TestCase extends Doctrine_UnitTestCase {
|
||||
}
|
||||
*/
|
||||
}
|
||||
?>
|
||||
|
@ -231,4 +231,3 @@ class Doctrine_Query_Select_TestCase extends Doctrine_UnitTestCase
|
||||
$this->assertEqual($users[4]->Phonenumber[0]->max, '444 555');
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -109,23 +109,22 @@ class Doctrine_Query_Subquery_TestCase extends Doctrine_UnitTestCase
|
||||
}
|
||||
|
||||
public function testAggregateFunctionsInOrderByAndHavingWithCount()
|
||||
{
|
||||
$q = new Doctrine_Query();
|
||||
|
||||
$q->select('u.*, COUNT(a.id) num_albums')
|
||||
->from('User u')
|
||||
->leftJoin('u.Album a')
|
||||
->orderby('num_albums desc')
|
||||
->groupby('u.id')
|
||||
->having('num_albums > 0')
|
||||
->limit(5);
|
||||
|
||||
try {
|
||||
$q->count();
|
||||
$this->pass();
|
||||
} catch (Doctrine_Exception $e) {
|
||||
$this->fail();
|
||||
}
|
||||
}
|
||||
{
|
||||
$q = new Doctrine_Query();
|
||||
|
||||
$q->select('u.*, COUNT(a.id) num_albums')
|
||||
->from('User u')
|
||||
->leftJoin('u.Album a')
|
||||
->orderby('num_albums desc')
|
||||
->groupby('u.id')
|
||||
->having('num_albums > 0')
|
||||
->limit(5);
|
||||
|
||||
try {
|
||||
$q->count();
|
||||
$this->pass();
|
||||
} catch (Doctrine_Exception $e) {
|
||||
$this->fail();
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -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)");
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -249,4 +249,3 @@ class Doctrine_RawSql_TestCase extends Doctrine_UnitTestCase
|
||||
$this->assertEqual(count($coll), 3);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -43,4 +43,3 @@ class Doctrine_Record_Filter_TestCase extends Doctrine_UnitTestCase {
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -47,7 +47,7 @@ class Doctrine_Record_TestCase extends Doctrine_UnitTestCase
|
||||
{
|
||||
$user = new User();
|
||||
$user->name = "Richard Linklater";
|
||||
|
||||
|
||||
$rel = $user->getTable()->getRelation('Account');
|
||||
|
||||
$this->assertTrue($rel instanceof Doctrine_Relation_ForeignKey);
|
||||
@ -148,7 +148,7 @@ class Doctrine_Record_TestCase extends Doctrine_UnitTestCase
|
||||
$this->connection->clear();
|
||||
$gzip = $gzip->getTable()->find($gzip->id);
|
||||
$this->assertEqual($gzip->gzip, "compressed");
|
||||
|
||||
|
||||
$gzip->gzip = "compressed 2";
|
||||
|
||||
$this->assertEqual($gzip->gzip, "compressed 2");
|
||||
@ -162,7 +162,7 @@ class Doctrine_Record_TestCase extends Doctrine_UnitTestCase
|
||||
{
|
||||
|
||||
$test = new FieldNameTest;
|
||||
|
||||
|
||||
$this->assertEqual($test->someColumn, 'some string');
|
||||
$this->assertEqual($test->someEnum, 'php');
|
||||
$this->assertEqual($test->someArray, array());
|
||||
@ -174,12 +174,12 @@ class Doctrine_Record_TestCase extends Doctrine_UnitTestCase
|
||||
public function testToArray()
|
||||
{
|
||||
$user = new User();
|
||||
|
||||
|
||||
$a = $user->toArray();
|
||||
|
||||
$this->assertTrue(is_array($a));
|
||||
$this->assertTrue(array_key_exists('name', $a));
|
||||
|
||||
|
||||
|
||||
$this->assertEqual($a['name'], null);
|
||||
$this->assertTrue(array_key_exists('id', $a));
|
||||
@ -196,7 +196,7 @@ class Doctrine_Record_TestCase extends Doctrine_UnitTestCase
|
||||
$this->assertEqual($a['name'], 'Someone');
|
||||
$this->assertTrue(array_key_exists('id', $a));
|
||||
$this->assertTrue(is_numeric($a['id']));
|
||||
|
||||
|
||||
$user->refresh();
|
||||
|
||||
$a = $user->toArray();
|
||||
@ -290,7 +290,7 @@ class Doctrine_Record_TestCase extends Doctrine_UnitTestCase
|
||||
$this->assertEqual($record->entity1, 3);
|
||||
|
||||
$this->assertEqual($record->identifier(), array("entity1" => 3, "entity2" => 4));
|
||||
|
||||
|
||||
$record->entity2 = 5;
|
||||
$record->entity1 = 2;
|
||||
$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->entity1, 2);
|
||||
$this->assertEqual($record->identifier(), array("entity1" => 2, "entity2" => 5));
|
||||
|
||||
|
||||
$record->refresh();
|
||||
$this->assertEqual($record->state(), Doctrine_Record::STATE_CLEAN);
|
||||
$this->assertEqual($record->entity2, 5);
|
||||
@ -320,7 +320,7 @@ class Doctrine_Record_TestCase extends Doctrine_UnitTestCase
|
||||
$record->entity2 = 6;
|
||||
$record->entity1 = 2;
|
||||
$record->save();
|
||||
|
||||
|
||||
$coll = $this->connection->query("FROM EntityReference");
|
||||
$this->assertTrue($coll[0] instanceof EntityReference);
|
||||
$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->getForeign(), "parent_id");
|
||||
$this->assertEqual($fk->getLocal(), "id");
|
||||
|
||||
|
||||
|
||||
|
||||
$e->name = "parent";
|
||||
@ -480,7 +480,7 @@ class Doctrine_Record_TestCase extends Doctrine_UnitTestCase
|
||||
$this->assertEqual($e2->code,2);
|
||||
$this->assertEqual($e2->file_md5, md5(1));
|
||||
$this->assertEqual($e2->message, 'user error2');
|
||||
|
||||
|
||||
|
||||
$fk = $e->getTable()->getRelation('Description');
|
||||
$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);
|
||||
|
||||
$e->save();
|
||||
|
||||
|
||||
$coll = $this->connection->query('FROM Error');
|
||||
$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');
|
||||
|
||||
// UPDATING
|
||||
|
||||
|
||||
$e->code = 2;
|
||||
$e->message = 'changed message';
|
||||
$e->Description[0]->description = '1st changed description';
|
||||
@ -542,9 +542,9 @@ class Doctrine_Record_TestCase extends Doctrine_UnitTestCase
|
||||
$user = new User();
|
||||
$user->name = "John Locke";
|
||||
$user->save();
|
||||
|
||||
|
||||
$this->assertTrue(is_numeric($user->id) && $user->id > 0);
|
||||
|
||||
|
||||
$this->assertTrue($user->getModified() == array());
|
||||
$this->assertTrue($user->state() == Doctrine_Record::STATE_CLEAN);
|
||||
|
||||
@ -720,7 +720,7 @@ class Doctrine_Record_TestCase extends Doctrine_UnitTestCase
|
||||
$user = $this->objTable->find(5);
|
||||
$this->assertTrue($user->Email instanceof Email);
|
||||
$this->assertEqual($user->Email->address, "absolutist@nottodrink.com");
|
||||
|
||||
|
||||
$emails = $this->connection->query("FROM Email WHERE Email.id = $id");
|
||||
//$this->assertEqual(count($emails),0);
|
||||
|
||||
@ -822,7 +822,7 @@ class Doctrine_Record_TestCase extends Doctrine_UnitTestCase
|
||||
$this->assertEqual($user->Group->count(), 0);
|
||||
$user = $this->objTable->find(5);
|
||||
$this->assertEqual($user->Group->count(), 0);
|
||||
|
||||
|
||||
|
||||
// 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[0] instanceof Groupuser);
|
||||
|
||||
|
||||
$user->name = "Jack Daniels";
|
||||
$user->Group[0]->name = "Group #1";
|
||||
$user->Group[1]->name = "Group #2";
|
||||
@ -839,10 +839,10 @@ class Doctrine_Record_TestCase extends Doctrine_UnitTestCase
|
||||
$t2 = time();
|
||||
$user->Groupuser[0]->added = $t1;
|
||||
$user->Groupuser[1]->added = $t2;
|
||||
|
||||
|
||||
$this->assertEqual($user->Groupuser[0]->added, $t1);
|
||||
$this->assertEqual($user->Groupuser[1]->added, $t2);
|
||||
|
||||
|
||||
$user->save();
|
||||
|
||||
$user->refresh();
|
||||
@ -874,21 +874,20 @@ class Doctrine_Record_TestCase extends Doctrine_UnitTestCase
|
||||
$user = $this->connection->getTable("User")->find(4);
|
||||
$this->assertTrue($user->getIterator() instanceof ArrayIterator);
|
||||
}
|
||||
|
||||
|
||||
public function testRefreshRelated()
|
||||
{
|
||||
$user = $this->connection->getTable("User")->find(4);
|
||||
$user->Address[0]->address = "Address #1";
|
||||
$user->Address[1]->address = "Address #2";
|
||||
$user->save();
|
||||
$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();
|
||||
$user->refreshRelated('Address');
|
||||
$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();
|
||||
$user->refreshRelated();
|
||||
$this->assertEqual(count($user->Address), 0);
|
||||
$user = $this->connection->getTable("User")->find(4);
|
||||
$user->Address[0]->address = "Address #1";
|
||||
$user->Address[1]->address = "Address #2";
|
||||
$user->save();
|
||||
$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();
|
||||
$user->refreshRelated('Address');
|
||||
$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();
|
||||
$user->refreshRelated();
|
||||
$this->assertEqual(count($user->Address), 0);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
||||
|
@ -6,78 +6,78 @@ class Doctrine_Relation_Access_TestCase extends Doctrine_UnitTestCase {
|
||||
$o2 = new File_Owner();
|
||||
$o2->name = "owner2";
|
||||
|
||||
$f1 = new Data_File();
|
||||
$f1 = new Data_File();
|
||||
$f1->filename = 'file1';
|
||||
$f2 = new Data_File();
|
||||
$f2 = new Data_File();
|
||||
$f2->filename = 'file2';
|
||||
$f3 = new Data_File();
|
||||
$f3 = new Data_File();
|
||||
$f3->filename = 'file3';
|
||||
|
||||
|
||||
$o1->Data_File->filename = 'file4';
|
||||
|
||||
// multiple left join branches test
|
||||
$us = array();
|
||||
$us[1] = new MyUser();
|
||||
$us[1]->name = "user1";
|
||||
// multiple left join branches test
|
||||
$us = array();
|
||||
$us[1] = new MyUser();
|
||||
$us[1]->name = "user1";
|
||||
$this->connection->flush();
|
||||
// OneThings
|
||||
$onethings_gs = array(
|
||||
array(6,1)
|
||||
);
|
||||
$count = 1;
|
||||
foreach($onethings_gs as $onething_g) {
|
||||
for($i=$count;$i<$count+$onething_g[0];$i++) {
|
||||
$d = new MyOneThing();
|
||||
$d->name = "onething".$i;
|
||||
if($onething_g[1]) {
|
||||
$us[$onething_g[1]]->MyOneThing->add($d);
|
||||
}
|
||||
}
|
||||
$count += $onething_g[0];
|
||||
}
|
||||
// OtherThings
|
||||
for($i=0;$i<6;$i++) {
|
||||
$o = new MyOtherThing();
|
||||
$o->name = "otherthing".$i;
|
||||
$us[1]->MyOtherThing->add($o);
|
||||
}
|
||||
// UserOneThings
|
||||
/* Doctrine assigns the foreign keys automatically
|
||||
$one_id_gs = array(
|
||||
array(array(2,3,6,5,1), 1)
|
||||
);
|
||||
foreach($one_id_gs as $one_ids) {
|
||||
foreach($one_ids[0] as $oid) {
|
||||
$od = new MyUserOneThing();
|
||||
$od->one_thing_id = $oid;
|
||||
$od->user_id = $one_ids[1];
|
||||
}
|
||||
}
|
||||
// UserOtherThings
|
||||
$oth_id_gs = array(
|
||||
array(array(5,4), 1)
|
||||
);
|
||||
foreach($oth_id_gs as $oth_ids) {
|
||||
foreach($oth_ids[0] as $oid) {
|
||||
$uo = new MyUserOtherThing();
|
||||
$uo->other_thing_id = $oid;
|
||||
$uo->user_id = $oth_ids[1];
|
||||
}
|
||||
}
|
||||
*/
|
||||
// OneThings
|
||||
$onethings_gs = array(
|
||||
array(6,1)
|
||||
);
|
||||
$count = 1;
|
||||
foreach($onethings_gs as $onething_g) {
|
||||
for($i=$count;$i<$count+$onething_g[0];$i++) {
|
||||
$d = new MyOneThing();
|
||||
$d->name = "onething".$i;
|
||||
if($onething_g[1]) {
|
||||
$us[$onething_g[1]]->MyOneThing->add($d);
|
||||
}
|
||||
}
|
||||
$count += $onething_g[0];
|
||||
}
|
||||
// OtherThings
|
||||
for($i=0;$i<6;$i++) {
|
||||
$o = new MyOtherThing();
|
||||
$o->name = "otherthing".$i;
|
||||
$us[1]->MyOtherThing->add($o);
|
||||
}
|
||||
// UserOneThings
|
||||
/* Doctrine assigns the foreign keys automatically
|
||||
$one_id_gs = array(
|
||||
array(array(2,3,6,5,1), 1)
|
||||
);
|
||||
foreach($one_id_gs as $one_ids) {
|
||||
foreach($one_ids[0] as $oid) {
|
||||
$od = new MyUserOneThing();
|
||||
$od->one_thing_id = $oid;
|
||||
$od->user_id = $one_ids[1];
|
||||
}
|
||||
}
|
||||
// UserOtherThings
|
||||
$oth_id_gs = array(
|
||||
array(array(5,4), 1)
|
||||
);
|
||||
foreach($oth_id_gs as $oth_ids) {
|
||||
foreach($oth_ids[0] as $oid) {
|
||||
$uo = new MyUserOtherThing();
|
||||
$uo->other_thing_id = $oid;
|
||||
$uo->user_id = $oth_ids[1];
|
||||
}
|
||||
}
|
||||
*/
|
||||
$this->connection->flush();
|
||||
$this->connection->clear();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function prepareTables() {
|
||||
$this->tables += array("MyUser",
|
||||
"MyOneThing",
|
||||
"MyUserOneThing",
|
||||
"MyOtherThing",
|
||||
"MyUserOtherThing");
|
||||
"MyOneThing",
|
||||
"MyUserOneThing",
|
||||
"MyOtherThing",
|
||||
"MyUserOtherThing");
|
||||
parent::prepareTables();
|
||||
}
|
||||
|
||||
|
||||
public function testOneToOneAggregateRelationFetching() {
|
||||
$coll = $this->connection->query("FROM File_Owner.Data_File WHERE File_Owner.name = 'owner1'");
|
||||
$this->assertTrue(count($coll) == 1);
|
||||
@ -87,131 +87,129 @@ class Doctrine_Relation_Access_TestCase extends Doctrine_UnitTestCase {
|
||||
}
|
||||
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'");
|
||||
$owner2 = $this->connection->query("FROM File_Owner.Data_File WHERE File_Owner.name = 'owner2'");
|
||||
$this->assertTrue(count($check) == 1);
|
||||
$owner2 = $this->connection->query("FROM File_Owner.Data_File WHERE File_Owner.name = 'owner2'");
|
||||
$this->assertTrue(count($check) == 1);
|
||||
|
||||
$this->assertTrue(count($owner2) == 1);
|
||||
$this->assertTrue(count($owner2) == 1);
|
||||
|
||||
$check = $check[0];
|
||||
$owner1 = $owner1[0];
|
||||
$owner2 = $owner2[0];
|
||||
$this->assertEqual($owner1->name, 'owner1');
|
||||
$check = $check[0];
|
||||
$owner1 = $owner1[0];
|
||||
$owner2 = $owner2[0];
|
||||
$this->assertEqual($owner1->name, 'owner1');
|
||||
$this->assertEqual($owner1->id, 1);
|
||||
|
||||
$check2 = $this->connection->query("FROM File_Owner WHERE File_Owner.id = ".$owner1->get('id'));
|
||||
$this->assertEqual(1, count($check2));
|
||||
$check2 = $check2[0];
|
||||
$this->assertEqual('owner1', $check2->get('name'));
|
||||
$check2 = $this->connection->query("FROM File_Owner WHERE File_Owner.id = ".$owner1->get('id'));
|
||||
$this->assertEqual(1, count($check2));
|
||||
$check2 = $check2[0];
|
||||
$this->assertEqual('owner1', $check2->get('name'));
|
||||
|
||||
$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, $owner1->get('id'));
|
||||
$this->assertEqual($owner1->get('id'), $check->get('id'));
|
||||
$this->assertEqual(2, $owner2->get('id'));
|
||||
$this->assertEqual($owner1->get('id'), $check->get('id'));
|
||||
$this->assertEqual(2, $owner2->get('id'));
|
||||
|
||||
}
|
||||
|
||||
public function testAccessOneToOneFromLocalSide() {
|
||||
$check = $this->connection->query("FROM Data_File WHERE Data_File.filename = 'file4'");
|
||||
public function testAccessOneToOneFromLocalSide() {
|
||||
$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'");
|
||||
$file2 = $this->connection->query("FROM Data_File.File_Owner WHERE Data_File.filename = 'file1'");
|
||||
$this->assertTrue(count($check) == 1);
|
||||
$this->assertTrue(count($file1) == 1);
|
||||
$this->assertTrue(count($file2) == 1);
|
||||
$file2 = $this->connection->query("FROM Data_File.File_Owner WHERE Data_File.filename = 'file1'");
|
||||
$this->assertTrue(count($check) == 1);
|
||||
$this->assertTrue(count($file1) == 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->assertFalse(isset($file2->File_Owner));
|
||||
$this->assertFalse(isset($file2->File_Owner));
|
||||
$this->assertEqual(4, $check->get('id'));
|
||||
$this->assertEqual(4, $file1->get('id'));
|
||||
$this->assertEqual($file1->get('id'), $check->get('id'));
|
||||
$this->assertEqual(1, $file2->get('id'));
|
||||
$this->assertEqual($file1->get('id'), $check->get('id'));
|
||||
$this->assertEqual(1, $file2->get('id'));
|
||||
|
||||
}
|
||||
|
||||
public function testMultipleLeftJoinBranches() {
|
||||
$query = "FROM MyUserOtherThing";
|
||||
$other = $this->connection->query($query);
|
||||
$check1 = array();
|
||||
foreach($other as $oth) {
|
||||
if(!isset($check1[$oth->other_thing_id])) {
|
||||
$check1[$oth->other_thing_id] = array();
|
||||
}
|
||||
$check1[$oth->other_thing_id][$oth->id] = $oth;
|
||||
}
|
||||
$query = "FROM MyUserOneThing";
|
||||
$ones = $this->connection->query($query);
|
||||
$check2 = array();
|
||||
foreach($ones as $one) {
|
||||
if(!isset($check2[$one->one_thing_id])) {
|
||||
$check2[$one->one_thing_id] = array();
|
||||
}
|
||||
$check2[$one->one_thing_id][$one->id] = $one;
|
||||
}
|
||||
|
||||
$query = "FROM MyUser,
|
||||
MyUser.MyOneThing,
|
||||
MyUser.MyOneThing.MyUserOneThing,
|
||||
MyUser.MyOtherThing,
|
||||
MyUser.MyOtherThing.MyUserOtherThing";
|
||||
$users = $this->connection->query($query);
|
||||
foreach($users as $u) {
|
||||
$this->assertEqual($u->MyOtherThing->count(), 6, "incorrect count of MyOtherThing");
|
||||
foreach($u->MyOtherThing as $o) {
|
||||
$in_check = array_key_exists($o->id, $check1);
|
||||
$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");
|
||||
foreach($o->MyUserOtherThing as $uo) {
|
||||
$this->assertEqual($uo->other_thing_id, $o->id, "incorrectly assigned MyOtherThing.id on MyUserOtherThing");
|
||||
if($in_check) {
|
||||
$wanted_user_thing_exists = array_key_exists($uo->id, $check1[$o->id]);
|
||||
$this->assertTrue($wanted_user_thing_exists, "MyUserOtherThing incorrectly assigned to MyOtherThing.");
|
||||
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]->other_thing_id, "incorrect value of MyUserOtherThing.other_thing_id");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$query = "FROM MyUser,
|
||||
MyUser.MyOtherThing,
|
||||
MyUser.MyOtherThing.MyUserOtherThing,
|
||||
MyUser.MyOneThing,
|
||||
MyUser.MyOneThing.MyUserOneThing";
|
||||
$users = $this->connection->query($query);
|
||||
foreach($users as $u) {
|
||||
$this->assertEqual($u->MyOneThing->count(), 6, "incorrect count of MyOneThing");
|
||||
foreach($u->MyOneThing as $o) {
|
||||
$in_check = array_key_exists($o->id, $check2);
|
||||
$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");
|
||||
foreach($o->MyUserOneThing as $uo) {
|
||||
$this->assertEqual($uo->one_thing_id, $o->id, "incorrectly assigned MyOneThing.id on MyUserOneThing");
|
||||
if($in_check) {
|
||||
$wanted_user_thing_exists = array_key_exists($uo->id, $check2[$o->id]);
|
||||
$this->assertTrue($wanted_user_thing_exists, "MyUserOneThing incorrectly assigned to MyOneThing.");
|
||||
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]->one_thing_id, "incorrect value of MyUserOneThing.one_thing_id");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function testMultipleLeftJoinBranches() {
|
||||
$query = "FROM MyUserOtherThing";
|
||||
$other = $this->connection->query($query);
|
||||
$check1 = array();
|
||||
foreach($other as $oth) {
|
||||
if(!isset($check1[$oth->other_thing_id])) {
|
||||
$check1[$oth->other_thing_id] = array();
|
||||
}
|
||||
$check1[$oth->other_thing_id][$oth->id] = $oth;
|
||||
}
|
||||
$query = "FROM MyUserOneThing";
|
||||
$ones = $this->connection->query($query);
|
||||
$check2 = array();
|
||||
foreach($ones as $one) {
|
||||
if(!isset($check2[$one->one_thing_id])) {
|
||||
$check2[$one->one_thing_id] = array();
|
||||
}
|
||||
$check2[$one->one_thing_id][$one->id] = $one;
|
||||
}
|
||||
|
||||
$query = "FROM MyUser,
|
||||
MyUser.MyOneThing,
|
||||
MyUser.MyOneThing.MyUserOneThing,
|
||||
MyUser.MyOtherThing,
|
||||
MyUser.MyOtherThing.MyUserOtherThing";
|
||||
$users = $this->connection->query($query);
|
||||
foreach($users as $u) {
|
||||
$this->assertEqual($u->MyOtherThing->count(), 6, "incorrect count of MyOtherThing");
|
||||
foreach($u->MyOtherThing as $o) {
|
||||
$in_check = array_key_exists($o->id, $check1);
|
||||
$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");
|
||||
foreach($o->MyUserOtherThing as $uo) {
|
||||
$this->assertEqual($uo->other_thing_id, $o->id, "incorrectly assigned MyOtherThing.id on MyUserOtherThing");
|
||||
if($in_check) {
|
||||
$wanted_user_thing_exists = array_key_exists($uo->id, $check1[$o->id]);
|
||||
$this->assertTrue($wanted_user_thing_exists, "MyUserOtherThing incorrectly assigned to MyOtherThing.");
|
||||
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]->other_thing_id, "incorrect value of MyUserOtherThing.other_thing_id");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$query = "FROM MyUser,
|
||||
MyUser.MyOtherThing,
|
||||
MyUser.MyOtherThing.MyUserOtherThing,
|
||||
MyUser.MyOneThing,
|
||||
MyUser.MyOneThing.MyUserOneThing";
|
||||
$users = $this->connection->query($query);
|
||||
foreach($users as $u) {
|
||||
$this->assertEqual($u->MyOneThing->count(), 6, "incorrect count of MyOneThing");
|
||||
foreach($u->MyOneThing as $o) {
|
||||
$in_check = array_key_exists($o->id, $check2);
|
||||
$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");
|
||||
foreach($o->MyUserOneThing as $uo) {
|
||||
$this->assertEqual($uo->one_thing_id, $o->id, "incorrectly assigned MyOneThing.id on MyUserOneThing");
|
||||
if($in_check) {
|
||||
$wanted_user_thing_exists = array_key_exists($uo->id, $check2[$o->id]);
|
||||
$this->assertTrue($wanted_user_thing_exists, "MyUserOneThing incorrectly assigned to MyOneThing.");
|
||||
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]->one_thing_id, "incorrect value of MyUserOneThing.one_thing_id");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -204,4 +204,3 @@ class Doctrine_Relation_ManyToMany_TestCase extends Doctrine_UnitTestCase {
|
||||
$this->assertEqual($component->name, 'changed name');
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -1,7 +1,5 @@
|
||||
<?php
|
||||
class Doctrine_RepositoryTestCase extends Doctrine_UnitTestCase {
|
||||
public function testAdd() {
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -237,4 +237,3 @@ class Doctrine_Table_TestCase extends Doctrine_UnitTestCase
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
@ -84,4 +84,3 @@ class Doctrine_Ticket_Njero_TestCase extends Doctrine_UnitTestCase
|
||||
#echo "Values " . serialize(array($c, $c2, $c3));
|
||||
|
||||
}
|
||||
}?>
|
||||
|
@ -294,4 +294,3 @@ class Doctrine_UnitTestCase extends UnitTestCase
|
||||
$this->init = true;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -411,4 +411,3 @@ class Doctrine_Validator_TestCase extends Doctrine_UnitTestCase
|
||||
$this->manager->setAttribute(Doctrine::ATTR_VLD, false);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -58,4 +58,3 @@ class Doctrine_ValueHolder_TestCase extends Doctrine_UnitTestCase {
|
||||
$this->assertTrue($f);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -74,7 +74,5 @@ class Doctrine_View_TestCase extends Doctrine_UnitTestCase
|
||||
|
||||
public function testConstructor()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
Loading…
x
Reference in New Issue
Block a user