/**
  * @dataProvider getDataProvider
  *
  * @param string $name
  * @param array  $options
  */
 public function testParse($name, array $options)
 {
     $classMetadataMock = $this->prophesize('Dunglas\\ApiBundle\\Mapping\\ClassMetadataInterface');
     $resourceMock = $this->prophesize('Dunglas\\ApiBundle\\Api\\ResourceInterface');
     $reflectionClassMock = $this->prophesize('\\ReflectionClass');
     $reflectionPropertyMock = $this->prophesize('\\ReflectionProperty');
     $attributeMetadataMock = $this->prophesize('Dunglas\\ApiBundle\\Mapping\\AttributeMetadata');
     $groupsMock = $this->prophesize('Symfony\\Component\\Serializer\\Annotation\\Groups');
     $resourceMock->getEntityClass()->willReturn('\\User')->shouldBeCalledTimes(1);
     $resourceMock->getNormalizationGroups()->willReturn(['user_output'])->shouldBeCalledTimes(1);
     $resourceMock->getDenormalizationGroups()->willReturn(['user_input'])->shouldBeCalled();
     $resourceMock->getValidationGroups()->shouldBeCalledTimes(1);
     $this->requestMock->getResource()->willReturn($resourceMock->reveal())->shouldBeCalledTimes(1);
     $this->classMetadataFactoryMock->getMetadataFor('\\User', ['user_output'], ['user_input'], null)->willReturn($classMetadataMock->reveal())->shouldBeCalledTimes(1);
     $this->requestMock->addHeader('Content-Type', 'application/json')->shouldBeCalledTimes(1);
     $this->requestMock->setDataMode(Request::DATA_MODE_RAW)->shouldBeCalledTimes(1);
     $classMetadataMock->getAttributes()->willReturn([$attributeMetadataMock->reveal()])->shouldBeCalledTimes(1);
     $attributeMetadataMock->getName()->willReturn($name)->shouldBeCalled();
     $classMetadataMock->getReflectionClass()->willReturn($reflectionClassMock->reveal())->shouldBeCalled();
     $reflectionClassMock->hasProperty($name)->willReturn($options['property'])->shouldBeCalledTimes(1);
     if ($options['property']) {
         $reflectionClassMock->getProperty($name)->willReturn($reflectionPropertyMock->reveal())->shouldBeCalledTimes(1);
         $this->readerMock->getPropertyAnnotation($reflectionPropertyMock->reveal(), 'Symfony\\Component\\Serializer\\Annotation\\Groups')->willReturn($groupsMock->reveal())->shouldBeCalledTimes(1);
         $attributeMetadataMock->isIdentifier()->willReturn($options['identifier'])->shouldBeCalledTimes(1);
         if (!$options['identifier']) {
             $attributeMetadataMock->isReadable()->willReturn($options['readable'])->shouldBeCalledTimes(1);
             if ($options['readable']) {
                 $groupsMock->getGroups()->willReturn($options['groups'])->shouldBeCalledTimes(1);
                 if (in_array('user_input', $options['groups'])) {
                     $this->guesserMock->guess($attributeMetadataMock->reveal())->willReturn('bar')->shouldBeCalledTimes(1);
                 }
             }
         }
     }
     $this->requestMock->setRawModeData($options['value'])->shouldBeCalledTimes(1);
     $this->parser->parse($this->requestMock->reveal());
 }
 public function testParse()
 {
     $this->requestMock->addHeader('Authorization', 'Bearer {{oauth2_access_token}}')->shouldBeCalledTimes(1);
     $parser = new OAuth2RequestParser('oauth2');
     $parser->parse($this->requestMock->reveal());
 }