protected function setUp() { parent::setUp(); $this->configManagerMock = $this->getMockBuilder('Oro\\Bundle\\EntityConfigBundle\\Config\\ConfigManager')->disableOriginalConstructor()->getMock(); $this->translatorMock = $this->getMockBuilder('Oro\\Bundle\\TranslationBundle\\Translation\\Translator')->disableOriginalConstructor()->getMock(); $this->translatorMock->expects($this->any())->method('trans')->will($this->returnCallback(function ($param) { return $param; })); $this->type = new FieldType($this->configManagerMock, $this->translatorMock, new ExtendDbIdentifierNameGenerator()); $this->typeReflection = new \ReflectionClass($this->type); }
protected function setUp() { parent::setUp(); $this->configManager = $this->getMockBuilder('Oro\\Bundle\\EntityConfigBundle\\Config\\ConfigManager')->disableOriginalConstructor()->getMock(); $this->translator = $this->getMockBuilder('Oro\\Bundle\\TranslationBundle\\Translation\\Translator')->disableOriginalConstructor()->getMock(); $this->translator->expects($this->any())->method('trans')->willReturnCallback(function ($id, $parameters) { if ($id === 'oro.entity_extend.form.data_type.inverse_relation') { return strtr('Reuse "%field_name%" of %entity_name%', $parameters); } return $id; }); $this->fieldTypeProvider = $this->getMockBuilder('Oro\\Bundle\\EntityExtendBundle\\Provider\\FieldTypeProvider')->disableOriginalConstructor()->getMock(); $this->fieldTypeProvider->expects($this->any())->method('getSupportedFieldTypes')->willReturn(array_keys($this->defaultFieldTypeChoices[self::FIELDS_GROUP])); $this->fieldTypeProvider->expects($this->any())->method('getSupportedRelationTypes')->willReturn(array_keys($this->defaultFieldTypeChoices[self::RELATIONS_GROUP])); $this->type = new FieldType($this->configManager, $this->translator, new ExtendDbIdentifierNameGenerator(), $this->fieldTypeProvider); }