/**
  * @covers phpDocumentor\Compiler\Pass\PackageTreeBuilder::execute
  * @covers phpDocumentor\Compiler\Pass\PackageTreeBuilder::addElementsOfTypeToPackage
  */
 public function testAddFunctionToNamespace()
 {
     $function = new FunctionDescriptor();
     $function->setPackage('My\\Space');
     $function->setFullyQualifiedStructuralElementName('My\\Space\\Function1');
     $this->project->getFiles()->get(0)->getFunctions()->add($function);
     // double check if a second function in the same deep namespace ends up at the right location
     $function2 = new FunctionDescriptor();
     $function2->setPackage('My\\Space');
     $function2->setFullyQualifiedStructuralElementName('My\\Space\\Function2');
     $this->project->getFiles()->get(0)->getFunctions()->add($function2);
     $this->fixture->execute($this->project);
     $this->assertSame(array($function, $function2), $this->project->getIndexes()->get('packages')->get('\\My\\Space')->getFunctions()->getAll());
 }