2009-11-06 20:03:59 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Doctrine\Tests\ORM\Query;
|
|
|
|
|
|
|
|
use Doctrine\ORM\Query\ParserResult;
|
|
|
|
|
|
|
|
class ParserResultTest extends \PHPUnit_Framework_TestCase
|
|
|
|
{
|
2011-01-13 23:16:08 +03:00
|
|
|
public $parserResult;
|
2009-11-06 20:03:59 +03:00
|
|
|
|
|
|
|
public function setUp()
|
|
|
|
{
|
2011-01-13 23:16:08 +03:00
|
|
|
$this->parserResult = new ParserResult();
|
2009-11-06 20:03:59 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testGetRsm()
|
|
|
|
{
|
|
|
|
$this->assertType(
|
|
|
|
'Doctrine\ORM\Query\ResultSetMapping',
|
2011-01-13 23:16:08 +03:00
|
|
|
$this->parserResult->getResultSetMapping()
|
2009-11-06 20:03:59 +03:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testSetGetSqlExecutor()
|
|
|
|
{
|
2011-01-13 23:16:08 +03:00
|
|
|
$this->assertNull($this->parserResult->getSqlExecutor());
|
2009-11-06 20:03:59 +03:00
|
|
|
|
|
|
|
$executor = $this->getMock('Doctrine\ORM\Query\Exec\AbstractSqlExecutor', array('execute'));
|
2011-01-13 23:16:08 +03:00
|
|
|
$this->parserResult->setSqlExecutor($executor);
|
|
|
|
$this->assertSame($executor, $this->parserResult->getSqlExecutor());
|
2009-11-06 20:03:59 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testGetSqlParameterPosition()
|
|
|
|
{
|
2011-01-13 23:16:08 +03:00
|
|
|
$this->parserResult->addParameterMapping(1, 1);
|
|
|
|
$this->parserResult->addParameterMapping(1, 2);
|
|
|
|
$this->assertEquals(array(1, 2), $this->parserResult->getSqlParameterPositions(1));
|
2009-11-06 20:03:59 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testGetParameterMappings()
|
|
|
|
{
|
2011-01-13 23:16:08 +03:00
|
|
|
$this->assertType('array', $this->parserResult->getParameterMappings());
|
2009-11-06 20:03:59 +03:00
|
|
|
|
2011-01-13 23:16:08 +03:00
|
|
|
$this->parserResult->addParameterMapping(1, 1);
|
|
|
|
$this->parserResult->addParameterMapping(1, 2);
|
|
|
|
$this->assertEquals(array(1 => array(1, 2)), $this->parserResult->getParameterMappings());
|
2009-11-06 20:03:59 +03:00
|
|
|
}
|
|
|
|
}
|