/** * Get original configPath (not changed by PayPal configuration inheritance) * * @param \Magento\Config\Model\Config\Structure\Element\Field $subject * @param \Closure $proceed * @return string|null */ public function aroundGetConfigPath(\Magento\Config\Model\Config\Structure\Element\Field $subject, \Closure $proceed) { $configPath = $proceed(); if (!isset($configPath) && $this->_request->getParam('section') == 'payment') { $configPath = preg_replace('@^(' . implode('|', \Magento\Paypal\Model\Config\StructurePlugin::getPaypalConfigCountries(true)) . ')/@', 'payment/', $subject->getPath()); } return $configPath; }
/** * Assert result of aroundGetElementByPathParts method * * @param \PHPUnit_Framework_MockObject_MockObject|null $result * @param \Closure $getElementByPathParts * @param array $pathParts */ private function _aroundGetElementByPathPartsAssertResult($result, $getElementByPathParts, $pathParts) { $this->assertEquals($result, $this->_model->aroundGetElementByPathParts($this->getMock('Magento\\Config\\Model\\Config\\Structure', [], [], '', false), $getElementByPathParts, $pathParts)); }
public function testGetPaypalConfigCountries() { $countries = StructurePlugin::getPaypalConfigCountries(false); $this->assertContains('payment_us', $countries); $this->assertNotContains('payment_other', $countries); }