[2.0] Fix Tab Formating in ParserResult class, added doc-comments and fixed a missing variable initialization error for certain query special cases.
This commit is contained in:
parent
1dae2eaf41
commit
93b20427c9
3 changed files with 70 additions and 7 deletions
|
@ -35,12 +35,26 @@ namespace Doctrine\ORM\Query;
|
|||
*/
|
||||
class ParserResult
|
||||
{
|
||||
/** The SQL executor used for executing the SQL. */
|
||||
private $_sqlExecutor;
|
||||
/** The ResultSetMapping that describes how to map the SQL result set. */
|
||||
/**
|
||||
* The SQL executor used for executing the SQL.
|
||||
*
|
||||
* @var \Doctrine\ORM\Query\Exec\AbstractSqlExecutor
|
||||
*/
|
||||
private $_sqlExecutor;
|
||||
|
||||
/**
|
||||
* The ResultSetMapping that describes how to map the SQL result set.
|
||||
*
|
||||
* @var \Doctrine\ORM\Query\ResultSetMapping
|
||||
*/
|
||||
private $_resultSetMapping;
|
||||
/** The mappings of DQL parameter names/positions to SQL parameter positions. */
|
||||
private $_parameterMappings;
|
||||
|
||||
/**
|
||||
* The mappings of DQL parameter names/positions to SQL parameter positions.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $_parameterMappings = array();
|
||||
|
||||
/**
|
||||
* Initializes a new instance of the <tt>ParserResult</tt> class.
|
||||
|
@ -75,7 +89,7 @@ class ParserResult
|
|||
/**
|
||||
* Sets the SQL executor that should be used for this ParserResult.
|
||||
*
|
||||
* @param AbstractExecutor $executor
|
||||
* @param \Doctrine\ORM\Query\Exec\AbstractSqlExecutor $executor
|
||||
*/
|
||||
public function setSqlExecutor($executor)
|
||||
{
|
||||
|
@ -85,7 +99,7 @@ class ParserResult
|
|||
/**
|
||||
* Gets the SQL executor used by this ParserResult.
|
||||
*
|
||||
* @return AbstractExecutor
|
||||
* @return \Doctrine\ORM\Query\Exec\AbstractSqlExecutor
|
||||
*/
|
||||
public function getSqlExecutor()
|
||||
{
|
||||
|
|
|
@ -25,6 +25,7 @@ class AllTests
|
|||
$suite->addTestSuite('Doctrine\Tests\ORM\Query\DeleteSqlGenerationTest');
|
||||
$suite->addTestSuite('Doctrine\Tests\ORM\Query\UpdateSqlGenerationTest');
|
||||
$suite->addTestSuite('Doctrine\Tests\ORM\Query\ExprTest');
|
||||
$suite->addTestSuite('Doctrine\Tests\ORM\Query\ParserResultTest');
|
||||
|
||||
return $suite;
|
||||
}
|
||||
|
|
48
tests/Doctrine/Tests/ORM/Query/ParserResultTest.php
Normal file
48
tests/Doctrine/Tests/ORM/Query/ParserResultTest.php
Normal file
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
|
||||
namespace Doctrine\Tests\ORM\Query;
|
||||
|
||||
use Doctrine\ORM\Query\ParserResult;
|
||||
|
||||
class ParserResultTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public $result;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$this->result = new ParserResult();
|
||||
}
|
||||
|
||||
public function testGetRsm()
|
||||
{
|
||||
$this->assertType(
|
||||
'Doctrine\ORM\Query\ResultSetMapping',
|
||||
$this->result->getResultSetMapping()
|
||||
);
|
||||
}
|
||||
|
||||
public function testSetGetSqlExecutor()
|
||||
{
|
||||
$this->assertNull($this->result->getSqlExecutor());
|
||||
|
||||
$executor = $this->getMock('Doctrine\ORM\Query\Exec\AbstractSqlExecutor', array('execute'));
|
||||
$this->result->setSqlExecutor($executor);
|
||||
$this->assertSame($executor, $this->result->getSqlExecutor());
|
||||
}
|
||||
|
||||
public function testGetSqlParameterPosition()
|
||||
{
|
||||
$this->result->addParameterMapping(1, 1);
|
||||
$this->result->addParameterMapping(1, 2);
|
||||
$this->assertEquals(array(1, 2), $this->result->getSqlParameterPositions(1));
|
||||
}
|
||||
|
||||
public function testGetParameterMappings()
|
||||
{
|
||||
$this->assertType('array', $this->result->getParameterMappings());
|
||||
|
||||
$this->result->addParameterMapping(1, 1);
|
||||
$this->result->addParameterMapping(1, 2);
|
||||
$this->assertEquals(array(1 => array(1, 2)), $this->result->getParameterMappings());
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue