25 private $objectManagerHelper;
30 private $configScopeDefinerMock;
35 private $backendHelperMock;
40 private $configStructureMock;
45 private $elementConfigStructureMock;
49 $this->configScopeDefinerMock = $this->getMockBuilder(ConfigScopeDefiner::class)
50 ->disableOriginalConstructor()
52 $this->backendHelperMock = $this->getMockBuilder(BackendHelper::class)
53 ->disableOriginalConstructor()
55 $this->configStructureMock = $this->getMockBuilder(ConfigStructure::class)
56 ->disableOriginalConstructor()
58 $this->elementConfigStructureMock = $this->getMockBuilder(ElementConfigStructure::class)
59 ->getMockForAbstractClass();
61 $this->objectManagerHelper =
new ObjectManagerHelper($this);
62 $this->plugin = $this->objectManagerHelper->getObject(
63 ConfigStructurePlugin::class,
65 'scopeDefiner' => $this->configScopeDefinerMock,
66 'backendHelper' => $this->backendHelperMock
73 $countries = ConfigStructurePlugin::getPaypalConfigCountries(
true);
75 $this->assertContains(
'payment_us', $countries);
76 $this->assertContains(
'payment_other', $countries);
81 $countries = ConfigStructurePlugin::getPaypalConfigCountries(
false);
83 $this->assertContains(
'payment_us', $countries);
84 $this->assertNotContains(
'payment_other', $countries);
95 $result = $returnResult ? $this->elementConfigStructureMock :
null;
96 $proceed =
function () use (
$result) {
102 $this->plugin->aroundGetElementByPathParts($this->configStructureMock, $proceed, $pathParts)
112 [[
'non-payment',
'group1',
'group2',
'field'],
true],
113 [[
'non-payment'],
true],
114 [[
'non-payment',
'group1',
'group2',
'field'],
false],
115 [[
'non-payment'],
false],
127 $proceed =
function () {
131 $this->backendHelperMock->expects(static::once())
132 ->method(
'getConfigurationCountryCode')
133 ->willReturn($countryCode);
137 $this->plugin->aroundGetElementByPathParts($this->configStructureMock, $proceed, $pathParts)
149 $result = $this->elementConfigStructureMock;
150 $proceed =
function () use (
$result) {
154 $this->backendHelperMock->expects(static::once())
155 ->method(
'getConfigurationCountryCode')
156 ->willReturn($countryCode);
159 $this->elementConfigStructureMock,
160 $this->plugin->aroundGetElementByPathParts($this->configStructureMock, $proceed, $pathParts)
171 [
'payment',
'group1',
'group2',
'field'],
175 [
'payment',
'group1',
'group2',
'field'],
testAroundGetElementByPathParts($pathParts, $countryCode)
testGetPaypalConfigCountries()
testGetPaypalConfigCountriesWithOther()
testAroundGetElementByPathPartsNoResult($pathParts, $countryCode)
testAroundGetElementByPathPartsNonPayment($pathParts, $returnResult)
aroundGetElementByPathPartsNonPaymentDataProvider()
aroundGetElementByPathPartsDataProvider()