/** * It should handle query execution and set the result. */ public function testHandleQueryExecute() { $locale = 'fr'; $primarySelector = 'p'; $this->query->getLocale()->willReturn($locale); $this->query->getPhpcrQuery()->willReturn($this->phpcrQuery->reveal()); $this->phpcrQuery->execute()->willReturn($this->phpcrResult->reveal()); $this->query->getPrimarySelector()->willReturn($primarySelector); $this->queryExecuteEvent->getQuery()->willReturn($this->query->reveal()); $this->queryExecuteEvent->getOptions()->willReturn([]); $this->queryExecuteEvent->setResult(new QueryResultCollection($this->phpcrResult->reveal(), $this->dispatcher->reveal(), $locale))->shouldBeCalled(); $this->subscriber->handleQueryExecute($this->queryExecuteEvent->reveal()); }
public function handleQueryExecute(QueryExecuteEvent $event) { $this->queryExecute = true; $event->setResult($this->resultCollection); }
/** * Handle query execution. * * @param QueryExecuteEvent $event */ public function handleQueryExecute(QueryExecuteEvent $event) { $query = $event->getQuery(); $locale = $query->getLocale(); $phpcrResult = $query->getPhpcrQuery()->execute(); $event->setResult(new QueryResultCollection($phpcrResult, $this->eventDispatcher, $locale, $event->getOptions())); }