/**
  * @expectedException \RuntimeException
  * @expectedExceptionMessage The object of class "stdClass" has no route with type "foo". Available types: view
  */
 public function testGenerateNonExistentType()
 {
     $metadata = new ClassMetadata('stdClass');
     $metadata->addRoute('view', 'view_name');
     $this->factory->expects($this->once())->method('getMetadataForClass')->will($this->returnValue($metadata));
     $this->router->generate('foo', new \stdClass());
 }
 public function loadMetadataForClass(\ReflectionClass $class)
 {
     $metadata = new ClassMetadata($class->name);
     $hasMetadata = false;
     foreach ($this->reader->getClassAnnotations($class) as $annot) {
         if ($annot instanceof ObjectRoute) {
             $hasMetadata = true;
             $metadata->addRoute($annot->type, $annot->name, $annot->params);
         }
     }
     return $hasMetadata ? $metadata : null;
 }