function it_should_properly_convert_parameter(Request $request, ParamConverter $paramConverter, Project $project, ProjectRepository $projectRepository, ParameterBag $parameterBag)
 {
     $parameterBag->has('projectSlug')->willReturn(true);
     $parameterBag->get('projectSlug')->willReturn('foobar');
     $parameterBag->set(Argument::type('string'), Argument::any())->shouldBeCalled();
     $request->attributes = $parameterBag;
     $projectRepository->findOneBy(['slug' => 'foobar'])->willReturn($project);
     $paramConverter->getClass()->willReturn('CiTron\\Project\\Entity\\Project');
     $paramConverter->getName()->willReturn('project');
     $this->apply($request, $paramConverter)->shouldReturn(true);
 }
 /**
  * @param Request $request
  * @param ParamConverter $configuration
  * @return bool
  */
 public function apply(Request $request, ParamConverter $configuration)
 {
     $parameter = 'projectSlug';
     if (!$request->attributes->has($parameter)) {
         return false;
     }
     $projectSlug = $request->attributes->get($parameter);
     $project = $this->projectRepository->findOneBy(['slug' => $projectSlug]);
     if (null === $project || !$project instanceof Project) {
         throw new NotFoundHttpException(sprintf('%s object not found.', $configuration->getClass()));
     }
     $request->attributes->set($configuration->getName(), $project);
     return true;
 }