ParserResultTest.php 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. namespace Doctrine\Tests\ORM\Query;
  3. use Doctrine\ORM\Query\ParserResult;
  4. class ParserResultTest extends \PHPUnit_Framework_TestCase
  5. {
  6. public $parserResult;
  7. public function setUp()
  8. {
  9. $this->parserResult = new ParserResult();
  10. }
  11. public function testGetRsm()
  12. {
  13. $this->assertInstanceOf(
  14. 'Doctrine\ORM\Query\ResultSetMapping',
  15. $this->parserResult->getResultSetMapping()
  16. );
  17. }
  18. public function testSetGetSqlExecutor()
  19. {
  20. $this->assertNull($this->parserResult->getSqlExecutor());
  21. $executor = $this->getMock('Doctrine\ORM\Query\Exec\AbstractSqlExecutor', array('execute'));
  22. $this->parserResult->setSqlExecutor($executor);
  23. $this->assertSame($executor, $this->parserResult->getSqlExecutor());
  24. }
  25. public function testGetSqlParameterPosition()
  26. {
  27. $this->parserResult->addParameterMapping(1, 1);
  28. $this->parserResult->addParameterMapping(1, 2);
  29. $this->assertEquals(array(1, 2), $this->parserResult->getSqlParameterPositions(1));
  30. }
  31. public function testGetParameterMappings()
  32. {
  33. $this->assertInternalType('array', $this->parserResult->getParameterMappings());
  34. $this->parserResult->addParameterMapping(1, 1);
  35. $this->parserResult->addParameterMapping(1, 2);
  36. $this->assertEquals(array(1 => array(1, 2)), $this->parserResult->getParameterMappings());
  37. }
  38. }