change tests for DDC-1135
This commit is contained in:
parent
728724bed5
commit
5fe996baf9
@ -82,6 +82,7 @@ class From
|
|||||||
*/
|
*/
|
||||||
public function __toString()
|
public function __toString()
|
||||||
{
|
{
|
||||||
return $this->_from . ' ' . $this->_alias . ($this->_indexBy ? ' INDEX BY ' . $this->_indexBy : '');
|
return $this->_from . ' ' . $this->_alias .
|
||||||
|
($this->_indexBy ? ' INDEX BY ' . $this->_indexBy : '');
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -14,23 +14,14 @@ class DDC1135Test extends \Doctrine\Tests\OrmFunctionalTestCase
|
|||||||
protected function setUp()
|
protected function setUp()
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
$classes = array(
|
|
||||||
$this->_em->getClassMetadata(__NAMESPACE__ . '\DDC1135User'),
|
|
||||||
$this->_em->getClassMetadata(__NAMESPACE__ . '\DDC1135Phone'),
|
|
||||||
);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$this->_schemaTool->dropSchema($classes);
|
$this->_schemaTool->createSchema(array(
|
||||||
$this->_schemaTool->createSchema($classes);
|
$this->_em->getClassMetadata(__NAMESPACE__ . '\DDC1135User'),
|
||||||
|
$this->_em->getClassMetadata(__NAMESPACE__ . '\DDC1135Phone'),
|
||||||
|
));
|
||||||
|
$this->loadFixture();
|
||||||
} catch(\Exception $e) {
|
} catch(\Exception $e) {
|
||||||
try {
|
|
||||||
$this->_schemaTool->createSchema($classes);
|
|
||||||
} catch (Exception $exc) {
|
|
||||||
$this->fail($exc->getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
$this->loadFixture();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -45,7 +36,6 @@ class DDC1135Test extends \Doctrine\Tests\OrmFunctionalTestCase
|
|||||||
$this->assertArrayHasKey(2, $result);
|
$this->assertArrayHasKey(2, $result);
|
||||||
$this->assertArrayHasKey(3, $result);
|
$this->assertArrayHasKey(3, $result);
|
||||||
|
|
||||||
|
|
||||||
$dql = 'SELECT u, p FROM '.__NAMESPACE__ . '\DDC1135User u INDEX BY u.email INNER JOIN u.phones p INDEX BY p.id';
|
$dql = 'SELECT u, p FROM '.__NAMESPACE__ . '\DDC1135User u INDEX BY u.email INNER JOIN u.phones p INDEX BY p.id';
|
||||||
$query = $this->_em->createQuery($dql);
|
$query = $this->_em->createQuery($dql);
|
||||||
$result = $query->getResult();
|
$result = $query->getResult();
|
||||||
@ -84,7 +74,7 @@ class DDC1135Test extends \Doctrine\Tests\OrmFunctionalTestCase
|
|||||||
$this->assertArrayHasKey(1, $result);
|
$this->assertArrayHasKey(1, $result);
|
||||||
$this->assertArrayHasKey(2, $result);
|
$this->assertArrayHasKey(2, $result);
|
||||||
$this->assertArrayHasKey(3, $result);
|
$this->assertArrayHasKey(3, $result);
|
||||||
$this->assertEquals('SELECT u FROM Doctrine\Tests\ORM\Functional\Ticket\DDC1135User u INDEX BY u.id', $dql);
|
$this->assertEquals('SELECT u FROM ' . __NAMESPACE__ . '\DDC1135User u INDEX BY u.id', $dql);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testIndexByUnique()
|
public function testIndexByUnique()
|
||||||
@ -99,7 +89,7 @@ class DDC1135Test extends \Doctrine\Tests\OrmFunctionalTestCase
|
|||||||
$this->assertArrayHasKey('foo@foo.com', $result);
|
$this->assertArrayHasKey('foo@foo.com', $result);
|
||||||
$this->assertArrayHasKey('bar@bar.com', $result);
|
$this->assertArrayHasKey('bar@bar.com', $result);
|
||||||
$this->assertArrayHasKey('foobar@foobar.com', $result);
|
$this->assertArrayHasKey('foobar@foobar.com', $result);
|
||||||
$this->assertEquals('SELECT u FROM Doctrine\Tests\ORM\Functional\Ticket\DDC1135User u INDEX BY u.email', $dql);
|
$this->assertEquals('SELECT u FROM ' . __NAMESPACE__ . '\DDC1135User u INDEX BY u.email', $dql);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testIndexWithJoin()
|
public function testIndexWithJoin()
|
||||||
@ -108,7 +98,6 @@ class DDC1135Test extends \Doctrine\Tests\OrmFunctionalTestCase
|
|||||||
$builder->select('u','p')
|
$builder->select('u','p')
|
||||||
->from(__NAMESPACE__ . '\DDC1135User', 'u', 'u.email')
|
->from(__NAMESPACE__ . '\DDC1135User', 'u', 'u.email')
|
||||||
->join('u.phones', 'p', null, null, 'p.id');
|
->join('u.phones', 'p', null, null, 'p.id');
|
||||||
|
|
||||||
|
|
||||||
$dql = $builder->getQuery()->getDQL();
|
$dql = $builder->getQuery()->getDQL();
|
||||||
$result = $builder->getQuery()->getResult();
|
$result = $builder->getQuery()->getResult();
|
||||||
@ -182,7 +171,7 @@ class DDC1135User
|
|||||||
*/
|
*/
|
||||||
public $phones;
|
public $phones;
|
||||||
|
|
||||||
public function __construct($email, $name,array $numbers)
|
public function __construct($email, $name, array $numbers = array())
|
||||||
{
|
{
|
||||||
$this->name = $name;
|
$this->name = $name;
|
||||||
$this->email = $email;
|
$this->email = $email;
|
||||||
|
Loading…
Reference in New Issue
Block a user