/**
  * @dataProvider dataTestApiDeclaration
  */
 public function testApiDeclaration($resource, $expected)
 {
     set_error_handler(array($this, 'handleDeprecation'));
     $data = $this->extractor->all();
     restore_error_handler();
     $actual = $this->formatter->format($data, $resource);
     $this->assertEquals($expected, $actual);
 }
 public function all($view = ApiDoc::DEFAULT_VIEW)
 {
     if ($this->cache->isFresh() === false) {
         $resources = array();
         foreach ($this->getRoutes() as $route) {
             if (null !== ($method = $this->getReflectionMethod($route->getDefault('_controller'))) && null !== ($annotation = $this->reader->getMethodAnnotation($method, self::ANNOTATION_CLASS))) {
                 $file = $method->getDeclaringClass()->getFileName();
                 $resources[] = new FileResource($file);
             }
         }
         $resources = array_merge($resources, $this->router->getRouteCollection()->getResources());
         $data = parent::all($view);
         $this->cache->write(serialize($data), $resources);
         return $data;
     }
     return unserialize(file_get_contents($this->cacheFile));
 }