1
0
mirror of synced 2024-12-13 14:56:01 +03:00
doctrine2/tests_old/Query/ShortAliasesTestCase.php

25 lines
854 B
PHP
Raw Normal View History

<?php
class Doctrine_Query_ShortAliases_TestCase extends Doctrine_UnitTestCase {
2007-01-03 18:34:34 +03:00
/**
public function testShortAliasesWithSingleComponent() {
$q = new Doctrine_Query();
2007-01-03 18:34:34 +03:00
$q->select('u.name')->from('User u');
$this->assertEqual($q->getQuery(), 'SELECT e.id AS e__id, e.name AS e__name FROM entity e WHERE (e.type = 0)');
}
2007-01-03 18:34:34 +03:00
*/
public function testShortAliasesWithOneToManyLeftJoin() {
$q = new Doctrine_Query();
$q->select('u.name, p.id')->from('User u LEFT JOIN u.Phonenumber p');
$this->assertEqual($q->getQuery(), 'SELECT e.id AS e__id, e.name AS e__name, p.id AS p__id FROM entity e LEFT JOIN phonenumber p ON e.id = p.entity_id WHERE (e.type = 0)');
$users = $q->execute();
$this->assertEqual($users->count(), 8);
}
}