예제 #1
0
 public function testGetEscapedValue()
 {
     $this->localeFormat->expects($this->any())->method('getPriceFormat')->willReturn(['precision' => 2, 'decimalSymbol' => ',', 'groupSymbol' => '.']);
     $this->_model->setValue('30000.4');
     $this->_model->setEntityAttribute(true);
     $return = $this->_model->getEscapedValue('30000.4');
     $this->assertEquals('30.000,40', $return);
 }
예제 #2
0
파일: TaxTest.php 프로젝트: nja78/magento2
 public function testGetEscapedValue()
 {
     $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
     $collectionFactory = $this->getMock('Magento\\Framework\\Data\\Form\\Element\\CollectionFactory', ['create'], [], '', false);
     $localeFormat = $this->getMock('\\Magento\\Framework\\Locale\\Format', [], [], '', false);
     $localeFormat->expects($this->any())->method('getPriceFormat')->willReturn(['precision' => 2, 'decimalSymbol' => ',', 'groupSymbol' => '.']);
     $factory = $this->getMock('Magento\\Framework\\Data\\Form\\Element\\Factory', [], [], '', false);
     $this->model = $objectManager->getObject('Magento\\Weee\\Block\\Element\\Weee\\Tax', ['factoryElement' => $factory, 'factoryCollection' => $collectionFactory, 'localeFormat' => $localeFormat]);
     $inputValue = [['value' => '30000.4']];
     $this->model->setValue($inputValue);
     $this->model->setEntityAttribute(true);
     $return = $this->model->getEscapedValue();
     $this->assertEquals([['value' => '30.000,40']], $return);
 }
예제 #3
0
 public function testGetEscapedValue()
 {
     $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
     $inputValue = [['value' => '30000.4']];
     $collectionFactory = $this->getMock('Magento\\Framework\\Data\\Form\\Element\\CollectionFactory', ['create'], [], '', false);
     $storeManager = $this->getMock('\\Magento\\Store\\Model\\StoreManager', [], [], '', false);
     $localeCurrency = $this->getMock('\\Magento\\Framework\\Locale\\Currency', [], [], '', false);
     $currency = $this->getMock('\\Magento\\Framework\\Currency', [], [], '', false);
     $currency->expects($this->any())->method('toCurrency')->willReturn('30.000,40');
     $localeCurrency->expects($this->any())->method('getCurrency')->willReturn($currency);
     $store = $this->getMock('\\Magento\\Store\\Model\\Store', [], [], '', false);
     $storeManager->expects($this->any())->method('getStore')->willReturn($store);
     $factory = $this->getMock('Magento\\Framework\\Data\\Form\\Element\\Factory', [], [], '', false);
     $this->model = $objectManager->getObject('Magento\\Weee\\Block\\Element\\Weee\\Tax', ['factoryElement' => $factory, 'factoryCollection' => $collectionFactory, 'storeManager' => $storeManager, 'localeCurrency' => $localeCurrency]);
     $this->model->setValue($inputValue);
     $this->model->setEntityAttribute(new \Magento\Framework\DataObject(['store_id' => 1]));
     $return = $this->model->getEscapedValue();
     $this->assertEquals([['value' => '30.000,40']], $return);
 }
예제 #4
0
 public function testGetEscapedValue()
 {
     $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
     $collectionFactory = $this->getMock('Magento\\Framework\\Data\\Form\\Element\\CollectionFactory', ['create'], [], '', false);
     $localeFormat = $this->getMock('\\Magento\\Framework\\Locale\\Format', [], [], '', false);
     $localeFormat->expects($this->any())->method('getPriceFormat')->willReturn(['precision' => 2, 'decimalSymbol' => ',', 'groupSymbol' => '.']);
     $helper = $this->getMock('Magento\\Catalog\\Helper\\Product', ['getTypeSwitcherControlLabel'], [], '', false, false);
     $helper->expects($this->any())->method('getTypeSwitcherControlLabel')->will($this->returnValue('Virtual / Downloadable'));
     $this->_virtual = $this->getMock('Magento\\Framework\\Data\\Form\\Element\\Checkbox', ['setId', 'setName', 'setLabel'], [], '', false, false);
     $this->_virtual->expects($this->any())->method('setId')->will($this->returnSelf());
     $this->_virtual->expects($this->any())->method('setName')->will($this->returnSelf());
     $this->_virtual->expects($this->any())->method('setLabel')->will($this->returnSelf());
     $factory = $this->getMock('Magento\\Framework\\Data\\Form\\Element\\Factory', [], [], '', false);
     $factory->expects($this->once())->method('create')->with($this->equalTo('checkbox'))->will($this->returnValue($this->_virtual));
     $this->_model = $objectManager->getObject('Magento\\Catalog\\Block\\Adminhtml\\Product\\Helper\\Form\\Weight', ['factoryElement' => $factory, 'factoryCollection' => $collectionFactory, 'helper' => $helper, 'localeFormat' => $localeFormat]);
     $this->_model->setValue('30000.4');
     $this->_model->setEntityAttribute(true);
     $return = $this->_model->getEscapedValue('30000.4');
     $this->assertEquals('30.000,40', $return);
 }