assume entity namespace when not given
This commit is contained in:
parent
3aa8d3fdac
commit
de93983dff
2 changed files with 460 additions and 352 deletions
File diff suppressed because it is too large
Load diff
|
@ -98,7 +98,7 @@ class NewOperatorTest extends \Doctrine\Tests\OrmFunctionalTestCase
|
||||||
e.email,
|
e.email,
|
||||||
a.city
|
a.city
|
||||||
)
|
)
|
||||||
FROM
|
FROM
|
||||||
Doctrine\Tests\Models\CMS\CmsUser u
|
Doctrine\Tests\Models\CMS\CmsUser u
|
||||||
JOIN
|
JOIN
|
||||||
u.email e
|
u.email e
|
||||||
|
@ -119,16 +119,40 @@ class NewOperatorTest extends \Doctrine\Tests\OrmFunctionalTestCase
|
||||||
$this->assertEquals($this->fixtures[0]->name, $result[0]->name);
|
$this->assertEquals($this->fixtures[0]->name, $result[0]->name);
|
||||||
$this->assertEquals($this->fixtures[1]->name, $result[1]->name);
|
$this->assertEquals($this->fixtures[1]->name, $result[1]->name);
|
||||||
$this->assertEquals($this->fixtures[2]->name, $result[2]->name);
|
$this->assertEquals($this->fixtures[2]->name, $result[2]->name);
|
||||||
|
|
||||||
$this->assertEquals($this->fixtures[0]->email->email, $result[0]->email);
|
$this->assertEquals($this->fixtures[0]->email->email, $result[0]->email);
|
||||||
$this->assertEquals($this->fixtures[1]->email->email, $result[1]->email);
|
$this->assertEquals($this->fixtures[1]->email->email, $result[1]->email);
|
||||||
$this->assertEquals($this->fixtures[2]->email->email, $result[2]->email);
|
$this->assertEquals($this->fixtures[2]->email->email, $result[2]->email);
|
||||||
|
|
||||||
$this->assertEquals($this->fixtures[0]->address->city, $result[0]->address);
|
$this->assertEquals($this->fixtures[0]->address->city, $result[0]->address);
|
||||||
$this->assertEquals($this->fixtures[1]->address->city, $result[1]->address);
|
$this->assertEquals($this->fixtures[1]->address->city, $result[1]->address);
|
||||||
$this->assertEquals($this->fixtures[2]->address->city, $result[2]->address);
|
$this->assertEquals($this->fixtures[2]->address->city, $result[2]->address);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testShouldAssumeFromEntityNamespaceWhenNotGiven()
|
||||||
|
{
|
||||||
|
$dql = "
|
||||||
|
SELECT
|
||||||
|
new CmsUserDTO(u.name, e.email, a.city)
|
||||||
|
FROM
|
||||||
|
Doctrine\Tests\Models\CMS\CmsUser u
|
||||||
|
JOIN
|
||||||
|
u.email e
|
||||||
|
JOIN
|
||||||
|
u.address a
|
||||||
|
ORDER BY
|
||||||
|
u.name";
|
||||||
|
|
||||||
|
$query = $this->_em->createQuery($dql);
|
||||||
|
$result = $query->getResult();
|
||||||
|
|
||||||
|
$this->assertCount(3, $result);
|
||||||
|
|
||||||
|
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[0]);
|
||||||
|
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[1]);
|
||||||
|
$this->assertInstanceOf('Doctrine\Tests\Models\CMS\CmsUserDTO', $result[2]);
|
||||||
|
}
|
||||||
|
|
||||||
public function testShouldSupportLiteralExpression()
|
public function testShouldSupportLiteralExpression()
|
||||||
{
|
{
|
||||||
$dql = "
|
$dql = "
|
||||||
|
@ -403,11 +427,11 @@ class NewOperatorTest extends \Doctrine\Tests\OrmFunctionalTestCase
|
||||||
{
|
{
|
||||||
$dql = "
|
$dql = "
|
||||||
SELECT
|
SELECT
|
||||||
new Doctrine\Tests\Models\CMS\CmsUserDTO(
|
new CmsUserDTO(
|
||||||
u.name,
|
u.name,
|
||||||
e.email
|
e.email
|
||||||
),
|
),
|
||||||
new Doctrine\Tests\Models\CMS\CmsAddressDTO(
|
new CmsAddressDTO(
|
||||||
a.country,
|
a.country,
|
||||||
a.city
|
a.city
|
||||||
)
|
)
|
||||||
|
@ -473,7 +497,7 @@ class NewOperatorTest extends \Doctrine\Tests\OrmFunctionalTestCase
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException Doctrine\ORM\Query\QueryException
|
* @expectedException Doctrine\ORM\Query\QueryException
|
||||||
* @expectedExceptionMessage [Semantical Error] line 0, col 68 near ') FROM Doctrine\Tests\Models\CMS\CmsUser': Error: Number of arguments does not match.
|
* @expectedExceptionMessage [Semantical Error] line 0, col 11 near 'Doctrine\Tests\ORM\Functional\ClassWithTooMuchArgs(u.name)': Error: Number of arguments does not match with "Doctrine\Tests\ORM\Functional\ClassWithTooMuchArgs" constructor declaration.
|
||||||
*/
|
*/
|
||||||
public function testInvalidClassWithoutConstructorException()
|
public function testInvalidClassWithoutConstructorException()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue