/** * @return array */ protected function getExtensions() { $entityType = new EntityType([1 => $this->getEntity('OroB2B\\Bundle\\PricingBundle\\Entity\\PriceList', 1), 2 => $this->getEntity('OroB2B\\Bundle\\PricingBundle\\Entity\\PriceList', 2)]); $productUnitSelection = new EntityType($this->prepareProductUnitSelectionChoices(), ProductUnitSelectionType::NAME); $priceType = new PriceType(); $priceType->setDataClass('Oro\\Bundle\\CurrencyBundle\\Model\\Price'); return [new PreloadedExtension([$entityType->getName() => $entityType, PriceListSelectType::NAME => new PriceListSelectTypeStub(), ProductUnitSelectionType::NAME => $productUnitSelection, PriceType::NAME => $priceType, CurrencySelectionType::NAME => new CurrencySelectionTypeStub()], []), new ValidatorExtension(Validation::createValidator())]; }
/** * @return array */ protected function getExtensions() { $unitSelectType = new EntityType(['kg' => $this->getEntity('OroB2B\\Bundle\\ProductBundle\\Entity\\ProductUnit', 'kg', 'code'), 'item' => $this->getEntity('OroB2B\\Bundle\\ProductBundle\\Entity\\ProductUnit', 'item', 'code')], ProductUnitSelectionType::NAME); $priceType = new PriceType(); $priceType->setDataClass('Oro\\Bundle\\CurrencyBundle\\Model\\Price'); $orderPriceType = new PriceTypeSelectorType(); $dateType = new OroDateType(); return [new PreloadedExtension([$unitSelectType->getName() => $unitSelectType, $priceType->getName() => $priceType, $orderPriceType->getName() => $orderPriceType, $dateType->getName() => $dateType], [])]; }
/** * {@inheritdoc} */ protected function getExtensions() { /* @var $configManager \PHPUnit_Framework_MockObject_MockObject|ConfigManager */ $configManager = $this->getMockBuilder('Oro\\Bundle\\ConfigBundle\\Config\\ConfigManager')->disableOriginalConstructor()->getMock(); $configManager->expects($this->any())->method('get')->with('oro_currency.allowed_currencies')->will($this->returnValue(['USD', 'EUR'])); /* @var $localeSettings \PHPUnit_Framework_MockObject_MockObject|LocaleSettings */ $localeSettings = $this->getMockBuilder('Oro\\Bundle\\LocaleBundle\\Model\\LocaleSettings')->disableOriginalConstructor()->getMock(); $currencyPrice = new PriceType(); $currencyPrice->setDataClass('Oro\\Bundle\\CurrencyBundle\\Model\\Price'); return [new PreloadedExtension([CurrencySelectionType::NAME => new CurrencySelectionType($configManager, $localeSettings), $currencyPrice->getName() => $currencyPrice], []), $this->getValidatorExtension(true)]; }
/** * @return array */ protected function getExtensions() { $entityType = new EntityType([1 => $this->getProductEntityWithPrecision(1, 'kg', 3), 2 => $this->getProductEntityWithPrecision(2, 'kg', 3)]); $productUnitSelection = new EntityType($this->prepareProductUnitSelectionChoices(), ProductUnitSelectionType::NAME); /** @var \PHPUnit_Framework_MockObject_MockObject|ConfigManager $configManager */ $configManager = $this->getMockBuilder('Oro\\Bundle\\ConfigBundle\\Config\\ConfigManager')->disableOriginalConstructor()->getMock(); $configManager->expects($this->any())->method('get')->with('oro_currency.allowed_currencies')->will($this->returnValue(['USD', 'EUR'])); /** @var \PHPUnit_Framework_MockObject_MockObject|LocaleSettings $localeSettings */ $localeSettings = $this->getMockBuilder('Oro\\Bundle\\LocaleBundle\\Model\\LocaleSettings')->disableOriginalConstructor()->getMock(); $productSelect = new ProductSelectTypeStub(); $priceType = new PriceType(); $priceType->setDataClass('Oro\\Bundle\\CurrencyBundle\\Model\\Price'); return [new PreloadedExtension([$entityType->getName() => $entityType, ProductSelectType::NAME => $productSelect, ProductUnitSelectionType::NAME => $productUnitSelection, PriceType::NAME => $priceType, CurrencySelectionType::NAME => new CurrencySelectionType($configManager, $localeSettings)], []), new ValidatorExtension(Validation::createValidator())]; }
/** * @return PriceType */ protected function preparePriceType() { $price = new PriceType(); $price->setDataClass('Oro\\Bundle\\CurrencyBundle\\Model\\Price'); return $price; }
/** * Test getName */ public function testGetName() { $this->assertEquals(PriceType::NAME, $this->formType->getName()); }