Code optimizations. Fixed unused argument in OrmTestCase as referred in DDC-766.
This commit is contained in:
parent
33bcf7ad6f
commit
eeba947ea7
@ -1328,18 +1328,18 @@ class Parser
|
||||
// We need to check if we are in a IdentificationVariable or SingleValuedPathExpression
|
||||
$glimpse = $this->_lexer->glimpse();
|
||||
|
||||
if ($glimpse['type'] != Lexer::T_DOT) {
|
||||
$token = $this->_lexer->lookahead;
|
||||
$identVariable = $this->IdentificationVariable();
|
||||
if ($glimpse['type'] == Lexer::T_DOT) {
|
||||
return $this->SingleValuedPathExpression();
|
||||
}
|
||||
|
||||
$token = $this->_lexer->lookahead;
|
||||
$identVariable = $this->IdentificationVariable();
|
||||
|
||||
if (!isset($this->_queryComponents[$identVariable])) {
|
||||
$this->semanticalError('Cannot group by undefined identification variable.');
|
||||
}
|
||||
|
||||
return $identVariable;
|
||||
if (!isset($this->_queryComponents[$identVariable])) {
|
||||
$this->semanticalError('Cannot group by undefined identification variable.');
|
||||
}
|
||||
|
||||
return $this->SingleValuedPathExpression();
|
||||
return $identVariable;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1354,12 +1354,9 @@ class Parser
|
||||
// We need to check if we are in a ResultVariable or StateFieldPathExpression
|
||||
$glimpse = $this->_lexer->glimpse();
|
||||
|
||||
if ($glimpse['type'] != Lexer::T_DOT) {
|
||||
$token = $this->_lexer->lookahead;
|
||||
$expr = $this->ResultVariable();
|
||||
} else {
|
||||
$expr = $this->SingleValuedPathExpression();
|
||||
}
|
||||
$expr = ($glimpse['type'] != Lexer::T_DOT)
|
||||
? $this->ResultVariable()
|
||||
: $this->SingleValuedPathExpression();
|
||||
|
||||
$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). */
|
||||
private static $_metadataCacheImpl = null;
|
||||
|
||||
/** The query cache that is shared between all ORM tests (except functional tests). */
|
||||
private static $_queryCacheImpl = null;
|
||||
|
||||
@ -66,30 +67,31 @@ abstract class OrmTestCase extends DoctrineTestCase
|
||||
*/
|
||||
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();
|
||||
if($withSharedMetadata) {
|
||||
$config->setMetadataCacheImpl(self::getSharedMetadataCacheImpl());
|
||||
} else {
|
||||
$config->setMetadataCacheImpl(new \Doctrine\Common\Cache\ArrayCache);
|
||||
}
|
||||
|
||||
|
||||
$config->setMetadataCacheImpl($metadataCache);
|
||||
$config->setMetadataDriverImpl($config->newDefaultAnnotationDriver());
|
||||
|
||||
$config->setQueryCacheImpl(self::getSharedQueryCacheImpl());
|
||||
$config->setProxyDir(__DIR__ . '/Proxies');
|
||||
$config->setProxyNamespace('Doctrine\Tests\Proxies');
|
||||
$eventManager = new \Doctrine\Common\EventManager();
|
||||
|
||||
if ($conn === null) {
|
||||
$conn = array(
|
||||
'driverClass' => 'Doctrine\Tests\Mocks\DriverMock',
|
||||
'driverClass' => 'Doctrine\Tests\Mocks\DriverMock',
|
||||
'wrapperClass' => 'Doctrine\Tests\Mocks\ConnectionMock',
|
||||
'user' => 'john',
|
||||
'password' => 'wayne'
|
||||
'user' => 'john',
|
||||
'password' => 'wayne'
|
||||
);
|
||||
}
|
||||
|
||||
if (is_array($conn)) {
|
||||
$conn = \Doctrine\DBAL\DriverManager::getConnection($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) {
|
||||
self::$_metadataCacheImpl = new \Doctrine\Common\Cache\ArrayCache;
|
||||
}
|
||||
|
||||
return self::$_metadataCacheImpl;
|
||||
}
|
||||
|
||||
@ -106,6 +109,7 @@ abstract class OrmTestCase extends DoctrineTestCase
|
||||
if (self::$_queryCacheImpl === null) {
|
||||
self::$_queryCacheImpl = new \Doctrine\Common\Cache\ArrayCache;
|
||||
}
|
||||
|
||||
return self::$_queryCacheImpl;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user