1
0
mirror of synced 2024-12-13 22:56:04 +03:00

assume entity namespace when not given

This commit is contained in:
Fabio B. Silva 2012-08-11 23:08:34 -03:00
parent 3aa8d3fdac
commit de93983dff
2 changed files with 460 additions and 352 deletions

File diff suppressed because it is too large Load Diff

View File

@ -129,6 +129,30 @@ class NewOperatorTest extends \Doctrine\Tests\OrmFunctionalTestCase
$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()
{
$dql = "
@ -403,11 +427,11 @@ class NewOperatorTest extends \Doctrine\Tests\OrmFunctionalTestCase
{
$dql = "
SELECT
new Doctrine\Tests\Models\CMS\CmsUserDTO(
new CmsUserDTO(
u.name,
e.email
),
new Doctrine\Tests\Models\CMS\CmsAddressDTO(
new CmsAddressDTO(
a.country,
a.city
)
@ -473,7 +497,7 @@ class NewOperatorTest extends \Doctrine\Tests\OrmFunctionalTestCase
/**
* @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()
{