1
0
mirror of synced 2025-02-03 05:49:25 +03:00
doctrine2/tests/Doctrine/Tests/ORM/Query/ParserResultTest.php
Sebastian Bergmann 9da83cfae8 Make test suite compatible with PHPUnit 5.4.
* Use createMock() and getMockBuilder() instead of getMock()
* Use expectException() and expectExceptionMessage() instead of setExpectedException()
2016-06-18 13:01:59 +02:00

49 lines
1.5 KiB
PHP

<?php
namespace Doctrine\Tests\ORM\Query;
use Doctrine\ORM\Query\Exec\AbstractSqlExecutor;
use Doctrine\ORM\Query\ParserResult;
class ParserResultTest extends \PHPUnit_Framework_TestCase
{
public $parserResult;
public function setUp()
{
$this->parserResult = new ParserResult();
}
public function testGetRsm()
{
$this->assertInstanceOf(
'Doctrine\ORM\Query\ResultSetMapping',
$this->parserResult->getResultSetMapping()
);
}
public function testSetGetSqlExecutor()
{
$this->assertNull($this->parserResult->getSqlExecutor());
$executor = $this->getMockBuilder(AbstractSqlExecutor::class)->setMethods(array('execute'))->getMock();
$this->parserResult->setSqlExecutor($executor);
$this->assertSame($executor, $this->parserResult->getSqlExecutor());
}
public function testGetSqlParameterPosition()
{
$this->parserResult->addParameterMapping(1, 1);
$this->parserResult->addParameterMapping(1, 2);
$this->assertEquals(array(1, 2), $this->parserResult->getSqlParameterPositions(1));
}
public function testGetParameterMappings()
{
$this->assertInternalType('array', $this->parserResult->getParameterMappings());
$this->parserResult->addParameterMapping(1, 1);
$this->parserResult->addParameterMapping(1, 2);
$this->assertEquals(array(1 => array(1, 2)), $this->parserResult->getParameterMappings());
}
}