public function testExecute()
 {
     $this->qb->expects($this->once())->method('getQuery')->will($this->returnValue($this->query));
     $this->query->expects($this->once())->method('execute')->will($this->returnValue('test'));
     $res = $this->pq->execute();
     $this->assertEquals('test', $res);
 }
 /**
  * @param ProxyQuery $query
  *
  * @return mixed
  */
 public function executeQuery($query)
 {
     return $query->execute();
 }
 public function testExecute()
 {
     $source = $this->getMock('PHPCR\\Query\\QOM\\SourceInterface', array(), array());
     $this->qf->expects($this->once())->method('selector')->with($this->anything())->will($this->returnValue($source));
     $dynamic_operand = $this->getMock('PHPCR\\Query\\QOM\\DynamicOperandInterface', array(), array());
     $static_operand = $this->getMock('PHPCR\\Query\\QOM\\StaticOperandInterface', array(), array());
     $this->qf->expects($this->any())->method('propertyValue')->with($this->anything())->will($this->returnValue($dynamic_operand));
     $constraint = $this->getMock('PHPCR\\Query\\QOM\\ConstraintInterface', array(), array());
     $this->qf->expects($this->once())->method('comparison')->with($this->anything())->will($this->returnValue($constraint));
     $this->qf->expects($this->once())->method('literal')->with($this->anything())->will($this->returnValue($static_operand));
     $this->qb->expects($this->once())->method('from')->with($this->anything());
     $this->qb->expects($this->once())->method('andWhere')->with($this->anything());
     $uow = $this->getMock('Doctrine\\ODM\\PHPCR\\UnitOfWork', array(), array(), '', false);
     $dm = $this->getMockBuilder('Doctrine\\ODM\\PHPCR\\DocumentManager')->disableOriginalConstructor()->getMock();
     $dm->expects($this->once())->method('getClassMetadata')->with("some_document_name")->will($this->returnValue(new dummyMetaData()));
     $dm->expects($this->exactly(2))->method('getUnitOfWork')->will($this->returnValue($uow));
     $query = $this->getMockBuilder('Jackalope\\Query\\QueryResult')->disableOriginalConstructor()->getMock();
     $query->expects($this->once())->method('getNodes')->will($this->returnValue(array('somepath1' => new NodeMock(), 'somepath2' => new NodeMock())));
     $this->qb->expects($this->once())->method('execute')->will($this->returnValue($query));
     $pq = new ProxyQuery($this->qf, $this->qb);
     $pq->setDocumentManager($dm);
     $pq->setDocumentName("some_document_name");
     $pq->execute();
 }