Commit 93b20427 authored by beberlei's avatar beberlei

[2.0] Fix Tab Formating in ParserResult class, added doc-comments and fixed a...

[2.0] Fix Tab Formating in ParserResult class, added doc-comments and fixed a missing variable initialization error for certain query special cases.
parent 1dae2eaf
...@@ -35,12 +35,26 @@ namespace Doctrine\ORM\Query; ...@@ -35,12 +35,26 @@ namespace Doctrine\ORM\Query;
*/ */
class ParserResult class ParserResult
{ {
/** The SQL executor used for executing the SQL. */ /**
* The SQL executor used for executing the SQL.
*
* @var \Doctrine\ORM\Query\Exec\AbstractSqlExecutor
*/
private $_sqlExecutor; private $_sqlExecutor;
/** The ResultSetMapping that describes how to map the SQL result set. */
/**
* The ResultSetMapping that describes how to map the SQL result set.
*
* @var \Doctrine\ORM\Query\ResultSetMapping
*/
private $_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. * Initializes a new instance of the <tt>ParserResult</tt> class.
...@@ -75,7 +89,7 @@ class ParserResult ...@@ -75,7 +89,7 @@ class ParserResult
/** /**
* Sets the SQL executor that should be used for this 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) public function setSqlExecutor($executor)
{ {
...@@ -85,7 +99,7 @@ class ParserResult ...@@ -85,7 +99,7 @@ class ParserResult
/** /**
* Gets the SQL executor used by this ParserResult. * Gets the SQL executor used by this ParserResult.
* *
* @return AbstractExecutor * @return \Doctrine\ORM\Query\Exec\AbstractSqlExecutor
*/ */
public function getSqlExecutor() public function getSqlExecutor()
{ {
......
...@@ -25,6 +25,7 @@ class AllTests ...@@ -25,6 +25,7 @@ class AllTests
$suite->addTestSuite('Doctrine\Tests\ORM\Query\DeleteSqlGenerationTest'); $suite->addTestSuite('Doctrine\Tests\ORM\Query\DeleteSqlGenerationTest');
$suite->addTestSuite('Doctrine\Tests\ORM\Query\UpdateSqlGenerationTest'); $suite->addTestSuite('Doctrine\Tests\ORM\Query\UpdateSqlGenerationTest');
$suite->addTestSuite('Doctrine\Tests\ORM\Query\ExprTest'); $suite->addTestSuite('Doctrine\Tests\ORM\Query\ExprTest');
$suite->addTestSuite('Doctrine\Tests\ORM\Query\ParserResultTest');
return $suite; return $suite;
} }
......
<?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());
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment