function it_throws_exception_when_attribute_is_unknown(ManagerRegistry $doctrine, EntityManager $em, ReferableEntityRepositoryInterface $repository, AttributeOption $option, ColumnInfoTransformerInterface $columnInfoTransformer, ColumnInfo $columnInfo, ClassMetadata $metadata, GuesserInterface $guesser, DefaultTransformer $defaultTransformer)
 {
     $class = 'Pim\\Bundle\\CatalogBundle\\Entity\\AttributeOption';
     $data = ['code' => 'blue', 'attribute' => 'color'];
     $doctrine->getManagerForClass($class)->willReturn($em);
     $em->getRepository($class)->willReturn($repository);
     $repository->getReferenceProperties()->willReturn(['attribute', 'code']);
     $repository->findByReference('color.blue')->willReturn($option);
     $columnInfoTransformer->transform($class, Argument::any())->willReturn($columnInfo);
     $columnInfo->getLabel()->willReturn('code');
     $em->getClassMetadata($class)->willReturn($metadata);
     $guesser->getTransformerInfo($columnInfo, $metadata)->willReturn([$defaultTransformer, []]);
     $columnInfo->getPropertyPath()->willReturn('attribute');
     $option->getAttribute()->willReturn(null);
     $option->getCode()->willReturn('blue');
     $exception = new \Exception(sprintf('The attribute used for option "%s" is not known', 'blue'));
     $this->shouldThrow($exception)->duringTransform($class, $data, []);
 }
 /**
  * Returns the transformer info for a column
  *
  * @param string              $class
  * @param ColumnInfoInterface $columnInfo
  *
  * @return array
  */
 protected function getTransformerInfo($class, ColumnInfoInterface $columnInfo)
 {
     $label = $columnInfo->getLabel();
     if (!isset($this->transformers[$class][$label])) {
         if (!isset($this->transformers[$class])) {
             $this->transformers[$class] = array();
         }
         $this->transformers[$class][$label] = $this->guesser->getTransformerInfo($columnInfo, $this->doctrine->getManagerForClass($class)->getClassMetadata($class));
         if (!$this->transformers[$class][$label]) {
             throw new UnknownColumnException(array($label), $class);
         }
     }
     return $this->transformers[$class][$label];
 }