*/ class TaoSearchGateWayTest extends \oat\search\test\UnitTestHelper { public function setUp() { $this->instance = new \oat\search\TaoSearchGateWay(); } /** * try connection */ public function testConnect() { $this->assertTrue($this->instance->connect()); } /** * print query verification */ public function testPrintQuery() { $fixtureQuery = 'select * from toto where id = 2'; $this->setInaccessibleProperty($this->instance, 'parsedQuery', $fixtureQuery); ob_start(); $this->assertSame( $this->instance, $this->instance->printQuery()); $contents = ob_get_contents(); ob_end_clean(); $this->assertSame( $fixtureQuery, $contents); } public function testSearch() { $this->instance = $this->getMock('\oat\search\TaoSearchGateWay' , ['serialyse']); $builderMock = $this->prophesize('oat\search\base\QueryBuilderInterface')->reveal(); $fixtureQuery = 'select * from toto where id = 2'; $this->instance->expects($this->once()) ->method('serialyse') ->with($builderMock) ->willReturn($fixtureQuery); $this->setInaccessibleProperty($this->instance, 'parsedQuery', $fixtureQuery); $this->assertSame( $fixtureQuery, $this->instance->search($builderMock)); } public function teaDown() { $this->instance = null; } }