Exemplo n.º 1
0
 public function testAddManyToOneRelationTargetSide()
 {
     $relationName = 'testRelation';
     $relationKey = 'manyToOne|Test\\SourceEntity|Test\\TargetEntity|testRelation';
     $extendConfig = new Config(new EntityConfigId('extend', self::TARGET_CLASS));
     $expectedExtendConfig = new Config(new EntityConfigId('extend', self::TARGET_CLASS));
     $expectedExtendConfig->set('relation', [$relationKey => ['assign' => false, 'target_field_id' => new FieldConfigId('extend', self::SOURCE_CLASS, $relationName, 'manyToOne'), 'owner' => false, 'target_entity' => self::SOURCE_CLASS, 'field_id' => false]]);
     $extendConfigProvider = $this->getConfigProviderMock();
     $extendConfigProvider->expects($this->once())->method('getConfig')->with(self::TARGET_CLASS)->will($this->returnValue($extendConfig));
     $extendConfigProvider->expects($this->once())->method('persist')->with($this->identicalTo($extendConfig));
     $this->configManager->expects($this->any())->method('getProvider')->will($this->returnValueMap([['extend', $extendConfigProvider]]));
     $this->builder->addManyToOneRelationTargetSide(self::TARGET_CLASS, self::SOURCE_CLASS, $relationName, $relationKey);
     $this->assertEquals($expectedExtendConfig, $extendConfig);
 }