/**
  * Creates a Descriptor from a provided class.
  *
  * @return void
  */
 public function testCreateFunctionDescriptorFromReflector()
 {
     $namespace = 'Namespace';
     $functionName = 'goodbyeWorld';
     $argumentName = 'waveHand';
     $argumentType = 'boolean';
     $docBlockDescriptionContent = trim('
         /**
          * This is a example description
          */
     ');
     $docBlockDescription = new DocBlock\Description($docBlockDescriptionContent);
     $docBlockMock = m::mock('phpDocumentor\\Reflection\\DocBlock');
     $docBlockMock->shouldReceive('getTagsByName')->andReturn(array());
     $docBlockMock->shouldReceive('getTags')->andReturn(array());
     $docBlockMock->shouldReceive('getShortDescription')->andReturn('This is a example description');
     $docBlockMock->shouldReceive('getLongDescription')->andReturn($docBlockDescription);
     $argumentMock = m::mock('phpDocumentor\\Descriptor\\Builder\\Reflector\\ArgumentAssembler');
     $argumentMock->shouldReceive('getName')->andReturn($argumentName);
     $argumentMock->shouldReceive('getType')->andReturn($argumentType);
     $argumentMock->shouldReceive('getDefault')->andReturn(true);
     $functionReflectorMock = m::mock('phpDocumentor\\Reflection\\FunctionReflector');
     $functionReflectorMock->shouldReceive('getName')->andReturn($namespace . '\\' . $functionName);
     $functionReflectorMock->shouldReceive('getShortName')->andReturn($functionName);
     $functionReflectorMock->shouldReceive('getNamespace')->andReturn($namespace);
     $functionReflectorMock->shouldReceive('getDocBlock')->andReturn($docBlockMock);
     $functionReflectorMock->shouldReceive('getLinenumber')->andReturn(128);
     $functionReflectorMock->shouldReceive('getArguments')->andReturn(array($argumentMock));
     $descriptor = $this->fixture->create($functionReflectorMock);
     $argument = $descriptor->getArguments()->get($argumentName);
     $this->assertSame($namespace . '\\' . $functionName . '()', $descriptor->getFullyQualifiedStructuralElementName());
     $this->assertSame($functionName, $descriptor->getName());
     $this->assertSame($argumentName, $argument->getName());
     $this->assertSame($argumentType, current($argument->getTypes()));
 }
 /**
  * @covers phpDocumentor\Descriptor\Builder\Reflector\FunctionAssembler::__construct
  * @covers phpDocumentor\Descriptor\Builder\Reflector\FunctionAssembler::create
  * @covers phpDocumentor\Descriptor\Builder\Reflector\FunctionAssembler::mapReflectorPropertiesOntoDescriptor
  * @covers phpDocumentor\Descriptor\Builder\Reflector\FunctionAssembler::addArgumentsToFunctionDescriptor
  * @covers phpDocumentor\Descriptor\Builder\Reflector\FunctionAssembler::createArgumentDescriptor
  * @covers phpDocumentor\Descriptor\Builder\Reflector\FunctionAssembler::addArgumentDescriptorToFunction
  * @covers phpDocumentor\Descriptor\Builder\Reflector\FunctionAssembler::getFullyQualifiedNamespaceName
  */
 public function testCreateFunctionDescriptorFromReflector()
 {
     // Arrange
     $namespace = 'Namespace';
     $functionName = 'goodbyeWorld';
     $argumentName = 'waveHand';
     $argumentDescriptorMock = $this->givenAnArgumentWithName($argumentName);
     $functionReflectorMock = $this->givenAFunctionReflector($namespace, $functionName, $argumentDescriptorMock, $this->givenADocBlockObject());
     // Act
     $descriptor = $this->fixture->create($functionReflectorMock);
     // Assert
     $expectedFqsen = $namespace . '\\' . $functionName . '()';
     $this->assertSame($expectedFqsen, $descriptor->getFullyQualifiedStructuralElementName());
     $this->assertSame($functionName, $descriptor->getName());
     $argument = $descriptor->getArguments()->get($argumentName);
     $this->assertSame($argument, $argumentDescriptorMock);
 }