/** * _Really_ obtain the config for a named class * @param string $class The class to get the config for * @return \Weasel\JsonMarshaller\Config\ClassMarshaller The config, or null if not found */ protected function _getConfig($class) { $rClass = new \ReflectionClass($class); // Delegate actually loading the config for the class to the ClassAnnotationDriver $classDriver = new ClassAnnotationDriver($rClass, $this->annotationReaderFactory, $this->annotationNamespace); return $classDriver->getConfig(); }
/** * @covers \Weasel\JsonMarshaller\Config\ClassAnnotationDriver::_configureGetter */ public function testGetterNameIsNoBool() { $rClass = new \ReflectionClass('\\Weasel\\JsonMarshaller\\Config\\ClassAnnotationDriverTestClassA'); $mockReader = m::mock('\\Weasel\\Common\\Annotation\\IAnnotationReader'); $mockReader->shouldReceive('getSingleClassAnnotation')->withAnyArgs()->andReturnNull(); $mockReader->shouldReceive('getSingleMethodAnnotation')->with('getStuff', '\\Weasel\\JsonMarshaller\\Config\\Annotations\\JsonProperty')->andReturn(new JsonProperty(null, "string", null)); $mockReader->shouldReceive('getSingleMethodAnnotation')->with('isGood', '\\Weasel\\JsonMarshaller\\Config\\Annotations\\JsonProperty')->andReturn(new JsonProperty(null, "string", null)); $mockReader->shouldReceive('getSingleMethodAnnotation')->withAnyArgs()->andReturnNull(); $mockReaderFactory = m::mock('\\Weasel\\Annotation\\AnnotationReaderFactory'); $mockReaderFactory->shouldReceive('getReaderForClass')->with($rClass)->andReturn($mockReader); /** * @var \Weasel\Annotation\AnnotationReaderFactory $mockReaderFactory */ $driver = new ClassAnnotationDriver($rClass, $mockReaderFactory); $config = $driver->getConfig(); $eProperties = array("stuff" => new GetterSerialization("getStuff", "string", 1), "isGood" => new GetterSerialization("isGood", "string", 1)); $this->assertEquals($eProperties, $config->serialization->properties); }