コード例 #1
0
 public function testValidateDuplicateAliasesWithCustomHelpMessage()
 {
     $this->metadataFactory->expects($this->any())->method('getAllMetadata')->willReturn([new ClassMetadata('Test\\Entity1'), new ClassMetadata('Test\\Entity2')]);
     $entityAliasProvider = $this->getMock('Oro\\Bundle\\EntityBundle\\Provider\\EntityAliasProviderInterface');
     $entityAliasProvider->expects($this->any())->method('getEntityAlias')->willReturnMap([['Test\\Entity1', new EntityAlias('alias', 'plural_alias1')], ['Test\\Entity2', new EntityAlias('alias', 'plural_alias2')]]);
     $this->entityAliasResolver->addProvider($entityAliasProvider);
     $this->entityAliasResolver->setDuplicateAliasHelpMessage('CUSTOM HELP MESSAGE');
     $this->setExpectedException('\\Oro\\Bundle\\EntityBundle\\Exception\\RuntimeException', 'The alias "alias" cannot be used for the entity "Test\\Entity2" because it is already ' . 'used for the entity "Test\\Entity1". CUSTOM HELP MESSAGE');
     $this->entityAliasResolver->getAll();
 }