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, []);
 }
 /**
  * Sets the properties of the entity
  *
  * @param string $class
  * @param object $entity
  * @param array  $data
  */
 protected function setProperties($class, $entity, array $data)
 {
     foreach ($data as $label => $value) {
         $columnInfo = $this->colInfoTransformer->transform($class, $label);
         $transformerInfo = $this->getTransformerInfo($class, $columnInfo);
         $error = $this->setProperty($entity, $columnInfo, $transformerInfo, $value);
         if ($error) {
             $this->errors[$class][$label] = array($error);
         }
     }
 }