diff --git a/tests/Unit/Query/IndicesQueryTest.php b/tests/Unit/Query/IndicesQueryTest.php index 8618830cd1ee4b1b6529c1abcee05e62d205daf2..f1de671820f886add662f14bb1ebc5dfd44f9ca2 100644 --- a/tests/Unit/Query/IndicesQueryTest.php +++ b/tests/Unit/Query/IndicesQueryTest.php @@ -11,44 +11,51 @@ namespace ONGR\ElasticsearchDSL\Tests\Unit\Query; +use ONGR\ElasticsearchDSL\BuilderInterface; use ONGR\ElasticsearchDSL\Query\IndicesQuery; class IndicesQueryTest extends \PHPUnit_Framework_TestCase { /** - * Data provider for testToArray(). - * - * @return array + * @return \PHPUnit_Framework_MockObject_MockObject|BuilderInterface */ - public function getTestToArrayData() + private function getQueryMock() { - $mock = $this->getMock('ONGR\ElasticsearchDSL\BuilderInterface'); + $mock = $this->getMockBuilder('ONGR\ElasticsearchDSL\BuilderInterface')->setMethods(['toArray', 'getType'])->getMock(); $mock ->expects($this->any()) ->method('toArray') ->willReturn(['term' => ['foo' => 'bar']]); - + return $mock; + } + /** + * Data provider for testToArray(). + * + * @return array + */ + public function getTestToArrayData() + { return [ [ - $mock, - $mock, + $this->getQueryMock(), + 'all', [ 'indices' => ['foo', 'bar'], 'query' => ['term' => ['foo' => 'bar']], - 'no_match_query' => ['term' => ['foo' => 'bar']], + 'no_match_query' => 'all', ] ], [ - $mock, - 'all', + $this->getQueryMock(), + $this->getQueryMock(), [ 'indices' => ['foo', 'bar'], 'query' => ['term' => ['foo' => 'bar']], - 'no_match_query' => 'all', + 'no_match_query' => ['term' => ['foo' => 'bar']], ] ], [ - $mock, + $this->getQueryMock(), null, [ 'indices' => ['foo', 'bar'],