function it_checks_a_non_existent_mapping_relationship($classMetadata, ConfigurationInterface $configuration) { $configuration->getName()->willReturn('foo'); $classMetadata->getAssociationMapping('foo')->willThrow(MappingException::mappingNotFound('spec\\Pim\\Bundle\\ReferenceDataBundle\\RequirementChecker\\CustomValidProductValue', 'foo')); $this->check($configuration)->shouldReturn(false); $this->getFailure()->shouldReturn("No mapping found for field 'foo' on class " . "'spec\\Pim\\Bundle\\ReferenceDataBundle\\RequirementChecker\\CustomValidProductValue'."); }
/** * Gets the mapping of an association. * * @see ClassMetadataInfo::$associationMappings * @param string $fieldName The field name that represents the association in * the object model. * @throws MappingException * @return array The mapping. */ public function getAssociationMapping($fieldName) { if (!isset($this->associationMappings[$fieldName])) { throw MappingException::mappingNotFound($this->name, $fieldName); } return $this->associationMappings[$fieldName]; }