Code optimizations. Fixed unused argument in OrmTestCase as referred in DDC-766.
This commit is contained in:
parent
33bcf7ad6f
commit
eeba947ea7
@ -1328,7 +1328,10 @@ class Parser
|
|||||||
// We need to check if we are in a IdentificationVariable or SingleValuedPathExpression
|
// We need to check if we are in a IdentificationVariable or SingleValuedPathExpression
|
||||||
$glimpse = $this->_lexer->glimpse();
|
$glimpse = $this->_lexer->glimpse();
|
||||||
|
|
||||||
if ($glimpse['type'] != Lexer::T_DOT) {
|
if ($glimpse['type'] == Lexer::T_DOT) {
|
||||||
|
return $this->SingleValuedPathExpression();
|
||||||
|
}
|
||||||
|
|
||||||
$token = $this->_lexer->lookahead;
|
$token = $this->_lexer->lookahead;
|
||||||
$identVariable = $this->IdentificationVariable();
|
$identVariable = $this->IdentificationVariable();
|
||||||
|
|
||||||
@ -1339,9 +1342,6 @@ class Parser
|
|||||||
return $identVariable;
|
return $identVariable;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->SingleValuedPathExpression();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* OrderByItem ::= (ResultVariable | SingleValuedPathExpression) ["ASC" | "DESC"]
|
* OrderByItem ::= (ResultVariable | SingleValuedPathExpression) ["ASC" | "DESC"]
|
||||||
*
|
*
|
||||||
@ -1354,12 +1354,9 @@ class Parser
|
|||||||
// We need to check if we are in a ResultVariable or StateFieldPathExpression
|
// We need to check if we are in a ResultVariable or StateFieldPathExpression
|
||||||
$glimpse = $this->_lexer->glimpse();
|
$glimpse = $this->_lexer->glimpse();
|
||||||
|
|
||||||
if ($glimpse['type'] != Lexer::T_DOT) {
|
$expr = ($glimpse['type'] != Lexer::T_DOT)
|
||||||
$token = $this->_lexer->lookahead;
|
? $this->ResultVariable()
|
||||||
$expr = $this->ResultVariable();
|
: $this->SingleValuedPathExpression();
|
||||||
} else {
|
|
||||||
$expr = $this->SingleValuedPathExpression();
|
|
||||||
}
|
|
||||||
|
|
||||||
$item = new AST\OrderByItem($expr);
|
$item = new AST\OrderByItem($expr);
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ abstract class OrmTestCase extends DoctrineTestCase
|
|||||||
{
|
{
|
||||||
/** The metadata cache that is shared between all ORM tests (except functional tests). */
|
/** The metadata cache that is shared between all ORM tests (except functional tests). */
|
||||||
private static $_metadataCacheImpl = null;
|
private static $_metadataCacheImpl = null;
|
||||||
|
|
||||||
/** The query cache that is shared between all ORM tests (except functional tests). */
|
/** The query cache that is shared between all ORM tests (except functional tests). */
|
||||||
private static $_queryCacheImpl = null;
|
private static $_queryCacheImpl = null;
|
||||||
|
|
||||||
@ -66,19 +67,18 @@ abstract class OrmTestCase extends DoctrineTestCase
|
|||||||
*/
|
*/
|
||||||
protected function _getTestEntityManager($conn = null, $conf = null, $eventManager = null, $withSharedMetadata = true)
|
protected function _getTestEntityManager($conn = null, $conf = null, $eventManager = null, $withSharedMetadata = true)
|
||||||
{
|
{
|
||||||
|
$metadataCache = $withSharedMetadata
|
||||||
|
? self::getSharedMetadataCacheImpl()
|
||||||
|
: new \Doctrine\Common\Cache\ArrayCache;
|
||||||
|
|
||||||
$config = new \Doctrine\ORM\Configuration();
|
$config = new \Doctrine\ORM\Configuration();
|
||||||
if($withSharedMetadata) {
|
|
||||||
$config->setMetadataCacheImpl(self::getSharedMetadataCacheImpl());
|
|
||||||
} else {
|
|
||||||
$config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
$config->setMetadataCacheImpl($metadataCache);
|
||||||
$config->setMetadataDriverImpl($config->newDefaultAnnotationDriver());
|
$config->setMetadataDriverImpl($config->newDefaultAnnotationDriver());
|
||||||
|
|
||||||
$config->setQueryCacheImpl(self::getSharedQueryCacheImpl());
|
$config->setQueryCacheImpl(self::getSharedQueryCacheImpl());
|
||||||
$config->setProxyDir(__DIR__ . '/Proxies');
|
$config->setProxyDir(__DIR__ . '/Proxies');
|
||||||
$config->setProxyNamespace('Doctrine\Tests\Proxies');
|
$config->setProxyNamespace('Doctrine\Tests\Proxies');
|
||||||
$eventManager = new \Doctrine\Common\EventManager();
|
|
||||||
if ($conn === null) {
|
if ($conn === null) {
|
||||||
$conn = array(
|
$conn = array(
|
||||||
'driverClass' => 'Doctrine\Tests\Mocks\DriverMock',
|
'driverClass' => 'Doctrine\Tests\Mocks\DriverMock',
|
||||||
@ -87,9 +87,11 @@ abstract class OrmTestCase extends DoctrineTestCase
|
|||||||
'password' => 'wayne'
|
'password' => 'wayne'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_array($conn)) {
|
if (is_array($conn)) {
|
||||||
$conn = \Doctrine\DBAL\DriverManager::getConnection($conn, $config, $eventManager);
|
$conn = \Doctrine\DBAL\DriverManager::getConnection($conn, $config, $eventManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
return \Doctrine\Tests\Mocks\EntityManagerMock::create($conn, $config, $eventManager);
|
return \Doctrine\Tests\Mocks\EntityManagerMock::create($conn, $config, $eventManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,6 +100,7 @@ abstract class OrmTestCase extends DoctrineTestCase
|
|||||||
if (self::$_metadataCacheImpl === null) {
|
if (self::$_metadataCacheImpl === null) {
|
||||||
self::$_metadataCacheImpl = new \Doctrine\Common\Cache\ArrayCache;
|
self::$_metadataCacheImpl = new \Doctrine\Common\Cache\ArrayCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
return self::$_metadataCacheImpl;
|
return self::$_metadataCacheImpl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,6 +109,7 @@ abstract class OrmTestCase extends DoctrineTestCase
|
|||||||
if (self::$_queryCacheImpl === null) {
|
if (self::$_queryCacheImpl === null) {
|
||||||
self::$_queryCacheImpl = new \Doctrine\Common\Cache\ArrayCache;
|
self::$_queryCacheImpl = new \Doctrine\Common\Cache\ArrayCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
return self::$_queryCacheImpl;
|
return self::$_queryCacheImpl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user