/** * @expectedException \Doctrine\Search\Exception\Driver\PropertyDoesNotExistsInMetadataException */ public function testLoadMetadataForClassAddValuesToMetadata() { $this->reflectionClass->expects($this->once())->method('getProperties')->will($this->returnValue(array())); $this->reader->expects($this->once())->method('getClassAnnotations')->will($this->returnValue(array(0, new TestSearchable(array())))); $this->classMetadata->expects($this->once())->method('getReflectionClass')->will($this->returnValue($this->reflectionClass)); $this->annotationDriver->loadMetadataForClass('Doctrine\\Tests\\Models\\Blog\\BlogPost', $this->classMetadata); }
public function setUp() { $this->reflectionService = $this->getAccessibleMock(\TYPO3\Flow\Reflection\ReflectionService::class, null); $this->mockAnnotationReader = $this->getMockBuilder(\Doctrine\Common\Annotations\Reader::class)->disableOriginalConstructor()->getMock(); $this->mockAnnotationReader->expects($this->any())->method('getClassAnnotations')->will($this->returnValue(array())); $this->inject($this->reflectionService, 'annotationReader', $this->mockAnnotationReader); }
/** * Test the getGeographicalQueryAnnotation method of the AnnotationDriver. */ public function testGetGeographicalQueryAnnotation() { $this->geographicalQueryAnnotation->expects($this->once())->method('getMethod')->will($this->returnValue('getAddress')); $this->reader->expects($this->once())->method('getMethodAnnotation')->with($this->isInstanceOf('\\ReflectionMethod'), $this->equalTo('Vich\\GeographicalBundle\\Annotation\\GeographicalQuery'))->will($this->returnValue($this->geographicalQueryAnnotation)); $annot = $this->driver->getGeographicalQueryAnnotation($this->geographicalEntity); $this->assertNotNull($annot); $this->assertEquals('getAddress', $annot->getMethod()); }