/** * {@inheritdoc} */ public function process($jsLayout) { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'process'); if (!$pluginInfo) { return parent::process($jsLayout); } else { return $this->___callPlugins('process', func_get_args(), $pluginInfo); } }
public function testProcess() { $countries = []; $regions = []; $layout = []; $layout['components']['block-summary']['children']['block-shipping']['children']['address-fieldsets']['children'] = ['fieldOne' => ['param' => 'value'], 'fieldTwo' => ['param' => 'value']]; $layoutPointer =& $layout['components']['block-summary']['children']['block-shipping']['children']['address-fieldsets']['children']; $this->countryCollection->expects($this->once())->method('load')->willReturnSelf(); $this->countryCollection->expects($this->once())->method('toOptionArray')->willReturn($countries); $this->regionCollection->expects($this->once())->method('load')->willReturnSelf(); $this->regionCollection->expects($this->once())->method('toOptionArray')->willReturn($regions); $layoutMerged = $layout; $layoutMerged['components']['block-summary']['children']['block-shipping']['children']['address-fieldsets']['children']['fieldThree'] = ['param' => 'value']; $layoutMergedPointer =& $layoutMerged['components']['block-summary']['children']['block-shipping']['children']['address-fieldsets']['children']; $elements = ['city' => ['visible' => false, 'formElement' => 'input', 'label' => __('City'), 'value' => null], 'country_id' => ['visible' => 1, 'formElement' => 'select', 'label' => __('Country'), 'options' => [], 'value' => null], 'region_id' => ['visible' => 1, 'formElement' => 'select', 'label' => __('State/Province'), 'options' => [], 'value' => null], 'postcode' => ['visible' => 1, 'formElement' => 'input', 'label' => __('Zip/Postal Code'), 'value' => null]]; $this->merger->expects($this->once())->method('merge')->with($elements, 'checkoutProvider', 'shippingAddress', $layoutPointer)->willReturn($layoutMergedPointer); $this->assertEquals($layoutMerged, $this->model->process($layout)); }
public function __construct(\Magento\Checkout\Block\Checkout\AttributeMerger $merger, \Magento\Directory\Model\ResourceModel\Country\Collection $countryCollection, \Magento\Directory\Model\ResourceModel\Region\Collection $regionCollection) { $this->___init(); parent::__construct($merger, $countryCollection, $regionCollection); }