CodeExplorer createTestProxy example
->
method('addOrderBy'
);
$builder =
$this->
getContainer()->
get(CriteriaQueryBuilder::
class);
$builder->
build($queryMock,
$productDefinition,
$criteria, Context::
createDefaultContext());
} public function testSortByScoreIfScoreQueryIsSet(): void
{ $productDefinition =
$this->
getContainer()->
get(ProductDefinition::
class);
$criteria =
new Criteria();
$criteria->
addQuery(new ScoreQuery(new ContainsFilter('name', 'test matching'
), 1000
));
$queryMock =
$this->
createTestProxy(QueryBuilder::
class,
[$this->
createMock(Connection::
class)]);
$queryMock ->
expects(static::
once()) ->
method('addOrderBy'
) ->
with('_score', 'DESC'
);
$builder =
$this->
getContainer()->
get(CriteriaQueryBuilder::
class);
$builder->
build($queryMock,
$productDefinition,
$criteria, Context::
createDefaultContext());
} public function testSortByScoreIfSearchTermIsSet(): void
{