function it_resolves_the_repository_of_a_reference_data($configurationRegistry, $doctrine, ConfigurationInterface $configuration, ObjectRepository $repository)
 {
     $configuration->getClass()->willReturn('Acme\\Bundle\\AppBundle\\Entity\\Color');
     $configurationRegistry->get('colors')->willReturn($configuration);
     $doctrine->getRepository('Acme\\Bundle\\AppBundle\\Entity\\Color')->willReturn($repository);
     $this->resolve('colors')->shouldReturn($repository);
 }
 function it_checks_an_invalid_reference_data($em, ConfigurationInterface $configuration, ClassMetadataInfo $metadata)
 {
     $em->getClassMetadata(Argument::any())->willReturn($metadata);
     $metadata->getFieldMapping('code')->willReturn(['fieldName' => "code", 'type' => "string", 'length' => 255, 'unique' => false, 'columnName' => "code"]);
     $configuration->getClass()->willReturn('\\StdClass');
     $this->check($configuration)->shouldReturn(false);
     $this->getFailure()->shouldReturn('Please configure a "code" column with a unique constraint in your Reference Data mapping.');
 }
 /**
  * {@inheritdoc}
  */
 public function check(ConfigurationInterface $configuration)
 {
     $this->model = $configuration->getClass();
     $reflection = new \ReflectionClass($this->model);
     if (!$reflection->implementsInterface($this->interface)) {
         $this->failure = sprintf('Please implement "%s" for your Reference Data model "%s".', $this->interface, $this->model);
         return false;
     }
     return true;
 }
 /**
  * {@inheritdoc}
  */
 public function check(ConfigurationInterface $configuration)
 {
     try {
         $mapping = $this->getCodeFieldMapping($configuration->getClass());
     } catch (\Exception $e) {
         $this->failure = $e->getMessage();
         return false;
     }
     if (!isset($mapping['unique']) || true !== $mapping['unique']) {
         $this->failure = 'Please configure a "code" column with a unique constraint ' . 'in your Reference Data mapping.';
         return false;
     }
     return true;
 }
 function it_checks_an_invalid_reference_data(ConfigurationInterface $configuration)
 {
     $configuration->getClass()->willReturn('\\StdClass');
     $this->check($configuration)->shouldReturn(false);
     $this->getFailure()->shouldReturn('Please implement "Pim\\Component\\ReferenceData\\Model\\ReferenceDataInterface" for your Reference Data model "\\StdClass".');
 }