some tests for MAP keyword
This commit is contained in:
parent
3e47532e07
commit
66d6136a92
@ -171,4 +171,37 @@ class Doctrine_Query_Join_TestCase extends Doctrine_UnitTestCase
|
|||||||
$this->fail();
|
$this->fail();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testMapKeywordForQueryWithOneComponent()
|
||||||
|
{
|
||||||
|
$q = new Doctrine_Query();
|
||||||
|
$coll = $q->from('Record_City c MAP c.name')->fetchArray();
|
||||||
|
|
||||||
|
$this->assertTrue(isset($coll['City 1']));
|
||||||
|
$this->assertTrue(isset($coll['City 2']));
|
||||||
|
$this->assertTrue(isset($coll['City 3']));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testMapKeywordSupportsJoins()
|
||||||
|
{
|
||||||
|
$q = new Doctrine_Query();
|
||||||
|
$country = $q->from('Record_Country c LEFT JOIN c.City c2 MAP c2.name')->fetchOne();
|
||||||
|
$coll = $country->City;
|
||||||
|
|
||||||
|
$this->assertTrue(isset($coll['City 1']));
|
||||||
|
$this->assertTrue(isset($coll['City 2']));
|
||||||
|
$this->assertTrue(isset($coll['City 3']));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testMapKeywordThrowsExceptionOnNonExistentColumn()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$q = new Doctrine_Query();
|
||||||
|
$country = $q->from('Record_Country c LEFT JOIN c.City c2 MAP c2.unknown')->fetchOne();
|
||||||
|
|
||||||
|
$this->fail();
|
||||||
|
} catch (Doctrine_Query_Exception $e) {
|
||||||
|
$this->pass();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user