13 private $layoutProcessor;
42 $this->merger = $this->getMockBuilder(\
Magento\Checkout\Block\Checkout\AttributeMerger::class)
43 ->disableOriginalConstructor()
45 $this->countryCollection =
47 ->disableOriginalConstructor()
49 $this->regionCollection =
51 ->disableOriginalConstructor()
53 $this->topDestinationCountries =
54 $this->getMockBuilder(\
Magento\Directory\Model\TopDestinationCountries::class)
55 ->disableOriginalConstructor()
57 $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
59 \
Magento\Checkout\Block\Cart\LayoutProcessor::class,
61 'merger' => $this->merger,
62 'countryCollection' => $this->countryCollection,
63 'regionCollection' => $this->regionCollection,
64 'topDestinationCountries' => $this->topDestinationCountries
76 $layout[
'components'][
'block-summary'][
'children'][
'block-shipping'][
'children']
77 [
'address-fieldsets'][
'children'] = [
78 'fieldOne' => [
'param' =>
'value'],
79 'fieldTwo' => [
'param' =>
'value']
81 $layoutPointer = &$layout[
'components'][
'block-summary'][
'children'][
'block-shipping']
82 [
'children'][
'address-fieldsets'][
'children'];
84 $this->countryCollection->expects($this->once())->method(
'loadByStore')->willReturnSelf();
85 $this->countryCollection
86 ->expects($this->once())
87 ->method(
'setForegroundCountries')
90 $this->countryCollection->expects($this->once())->method(
'toOptionArray')->willReturn($countries);
92 $this->regionCollection->expects($this->once())->method(
'addAllowedCountriesFilter')->willReturnSelf();
93 $this->regionCollection->expects($this->once())->method(
'toOptionArray')->willReturn($regions);
95 $this->topDestinationCountries->expects($this->once())->method(
'getTopDestinations')
98 $layoutMerged = $layout;
99 $layoutMerged[
'components'][
'block-summary'][
'children'][
'block-shipping'][
'children']
100 [
'address-fieldsets'][
'children'][
'fieldThree'] = [
'param' =>
'value'];
101 $layoutMergedPointer = &$layoutMerged[
'components'][
'block-summary'][
'children'][
'block-shipping']
102 [
'children'][
'address-fieldsets'][
'children'];
103 $layoutMerged[
'components'][
'checkoutProvider'] = [
112 'formElement' =>
'input',
113 'label' =>
__(
'City'),
118 'formElement' =>
'select',
119 'label' =>
__(
'Country'),
125 'formElement' =>
'select',
126 'label' =>
__(
'State/Province'),
132 'formElement' =>
'input',
133 'label' =>
__(
'Zip/Postal Code'),
137 $this->merger->expects($this->once())
139 ->with($elements,
'checkoutProvider',
'shippingAddress', $layoutPointer)
140 ->willReturn($layoutMergedPointer);
142 $this->assertEquals($layoutMerged, $this->layoutProcessor->process($layout));