Skip to content
Snippets Groups Projects
Commit d08f3cb3 authored by Simonas Šerlinskas's avatar Simonas Šerlinskas
Browse files

support phpunit 5 new mock reference logic

parent be4a87d6
No related branches found
No related tags found
No related merge requests found
...@@ -11,44 +11,51 @@ ...@@ -11,44 +11,51 @@
namespace ONGR\ElasticsearchDSL\Tests\Unit\Query; namespace ONGR\ElasticsearchDSL\Tests\Unit\Query;
use ONGR\ElasticsearchDSL\BuilderInterface;
use ONGR\ElasticsearchDSL\Query\IndicesQuery; use ONGR\ElasticsearchDSL\Query\IndicesQuery;
class IndicesQueryTest extends \PHPUnit_Framework_TestCase class IndicesQueryTest extends \PHPUnit_Framework_TestCase
{ {
/** /**
* Data provider for testToArray(). * @return \PHPUnit_Framework_MockObject_MockObject|BuilderInterface
*
* @return array
*/ */
public function getTestToArrayData() private function getQueryMock()
{ {
$mock = $this->getMock('ONGR\ElasticsearchDSL\BuilderInterface'); $mock = $this->getMockBuilder('ONGR\ElasticsearchDSL\BuilderInterface')->setMethods(['toArray', 'getType'])->getMock();
$mock $mock
->expects($this->any()) ->expects($this->any())
->method('toArray') ->method('toArray')
->willReturn(['term' => ['foo' => 'bar']]); ->willReturn(['term' => ['foo' => 'bar']]);
return $mock;
}
/**
* Data provider for testToArray().
*
* @return array
*/
public function getTestToArrayData()
{
return [ return [
[ [
$mock, $this->getQueryMock(),
$mock, 'all',
[ [
'indices' => ['foo', 'bar'], 'indices' => ['foo', 'bar'],
'query' => ['term' => ['foo' => 'bar']], 'query' => ['term' => ['foo' => 'bar']],
'no_match_query' => ['term' => ['foo' => 'bar']], 'no_match_query' => 'all',
] ]
], ],
[ [
$mock, $this->getQueryMock(),
'all', $this->getQueryMock(),
[ [
'indices' => ['foo', 'bar'], 'indices' => ['foo', 'bar'],
'query' => ['term' => ['foo' => 'bar']], 'query' => ['term' => ['foo' => 'bar']],
'no_match_query' => 'all', 'no_match_query' => ['term' => ['foo' => 'bar']],
] ]
], ],
[ [
$mock, $this->getQueryMock(),
null, null,
[ [
'indices' => ['foo', 'bar'], 'indices' => ['foo', 'bar'],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment