/**
  * @covers phpDocumentor\Descriptor\FileDescriptor::__construct
  * @covers phpDocumentor\Descriptor\FileDescriptor::getAllErrors
  */
 public function testGetAllErrors()
 {
     /*
      * constant
      * function
      * class
      *     property
      *     constant
      *     method
      * interface
      *     constant
      *     method
      * traits
      *     property
      *     method
      */
     // setup error list
     $errorGlobal = array('error-global');
     $errorClasses = array('error-class');
     $errorClassMethods = array('error-class-method');
     $errorClassConstants = array('error-class-constant');
     $errorClassProperties = array('error-class-property');
     $errorInterfaces = array('error-interface');
     $errorInterfacesConstants = array('error-interface-constant');
     $errorInterfacesMethods = array('error-interface-method');
     $errorTraits = array('error-traits');
     $errorTraitsProperties = array('error-traits-property');
     $errorTraitsMethods = array('error-traits-method');
     $errorFunctions = array('error-functions');
     // setup global check
     $collection = new Collection($errorGlobal);
     $this->fixture->setErrors($collection);
     // setup class-property check
     $mockClassProperties = m::mock('phpDocumentor\\Descriptor\\PropertyDescriptor');
     $mockClassProperties->shouldReceive('getErrors')->andReturn(new Collection($errorClassProperties));
     // setup class-constant check
     $mockClassConstants = m::mock('phpDocumentor\\Descriptor\\ConstantDescriptor');
     $mockClassConstants->shouldReceive('getErrors')->andReturn(new Collection($errorClassConstants));
     // setup class-method check
     $mockClassMethods = m::mock('phpDocumentor\\Descriptor\\MethodDescriptor');
     $mockClassMethods->shouldReceive('getErrors')->andReturn(new Collection($errorClassMethods));
     // setup class check
     $mockClasses = m::mock('phpDocumentor\\Descriptor\\ClassDescriptor');
     $mockClasses->shouldReceive('getProperties')->andReturn(new Collection(array($mockClassProperties)));
     $mockClasses->shouldReceive('getConstants')->andReturn(new Collection(array($mockClassConstants)));
     $mockClasses->shouldReceive('getMethods')->andReturn(new Collection(array($mockClassMethods)));
     $mockClasses->shouldReceive('getErrors')->andReturn(new Collection($errorClasses));
     $this->fixture->getClasses()->set('my-test-class', $mockClasses);
     // setup interface-constant check
     $mockInterfaceConstants = m::mock('phpDocumentor\\Descriptor\\ConstantDescriptor');
     $mockInterfaceConstants->shouldReceive('getErrors')->andReturn(new Collection($errorInterfacesConstants));
     // setup interface-method check
     $mockInterfaceMethods = m::mock('phpDocumentor\\Descriptor\\MethodDescriptor');
     $mockInterfaceMethods->shouldReceive('getErrors')->andReturn(new Collection($errorInterfacesMethods));
     // setup interface check
     $mockInterfaces = m::mock('phpDocumentor\\Descriptor\\ClassDescriptor');
     $mockInterfaces->shouldReceive('getProperties')->andReturn(array());
     $mockInterfaces->shouldReceive('getConstants')->andReturn(new Collection(array($mockInterfaceConstants)));
     $mockInterfaces->shouldReceive('getMethods')->andReturn(new Collection(array($mockInterfaceMethods)));
     $mockInterfaces->shouldReceive('getErrors')->andReturn(new Collection($errorInterfaces));
     $this->fixture->getClasses()->set('my-test-interface', $mockInterfaces);
     // setup traits-constant check
     $mockTraitsProperties = m::mock('phpDocumentor\\Descriptor\\ConstantDescriptor');
     $mockTraitsProperties->shouldReceive('getErrors')->andReturn(new Collection($errorTraitsProperties));
     // setup traits-method check
     $mockTraitsMethods = m::mock('phpDocumentor\\Descriptor\\MethodDescriptor');
     $mockTraitsMethods->shouldReceive('getErrors')->andReturn(new Collection($errorTraitsMethods));
     // setup traits check
     $mockTraits = m::mock('phpDocumentor\\Descriptor\\ClassDescriptor');
     $mockTraits->shouldReceive('getConstants')->andReturn(array());
     $mockTraits->shouldReceive('getProperties')->andReturn(new Collection(array($mockTraitsProperties)));
     $mockTraits->shouldReceive('getMethods')->andReturn(new Collection(array($mockTraitsMethods)));
     $mockTraits->shouldReceive('getErrors')->andReturn(new Collection($errorTraits));
     $this->fixture->getClasses()->set('my-test-traits', $mockTraits);
     // setup functions check
     $mockFunctions = m::mock('phpDocumentor\\Descriptor\\FunctionDescriptor');
     // create dummy instances of constants/methods
     $mockFunctions->shouldReceive('getConstants')->andReturn(array());
     $mockFunctions->shouldReceive('getProperties')->andReturn(array());
     $mockFunctions->shouldReceive('getMethods')->andReturn(array());
     $mockFunctions->shouldReceive('getErrors')->andReturn(new Collection($errorFunctions));
     $this->fixture->getClasses()->set('my-test-function', $mockFunctions);
     // final merge and check
     $expectedErrors = array_merge($errorGlobal, $errorClasses, $errorInterfaces, $errorTraits, $errorFunctions, $errorClassMethods, $errorClassConstants, $errorClassProperties, $errorInterfacesMethods, $errorInterfacesConstants, $errorTraitsMethods, $errorTraitsProperties);
     $this->assertSame($expectedErrors, $this->fixture->getAllErrors()->getAll());
 }