Skip to content

Commit

Permalink
Merge branch 2.3-develop into ENGCOM-4636-magento-magento2-21932
Browse files Browse the repository at this point in the history
  • Loading branch information
magento-engcom-team committed Apr 10, 2019
2 parents fd177e0 + ab188bc commit 6bbd681
Show file tree
Hide file tree
Showing 17 changed files with 229 additions and 2,813 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ public function process($path, $value, $scope, $scopeCode)
}

try {
$config = $this->configFactory->create([
$config = $this->configFactory->create(['data' => [
'scope' => $scope,
'scope_code' => $scopeCode,
]);
]]);
$config->setDataByPath($path, $value);
$config->save();
} catch (\Exception $exception) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public function testProcess($path, $value, $scope, $scopeCode)
$config = $this->createMock(Config::class);
$this->configFactory->expects($this->once())
->method('create')
->with(['scope' => $scope, 'scope_code' => $scopeCode])
->with(['data' => ['scope' => $scope, 'scope_code' => $scopeCode]])
->willReturn($config);
$config->expects($this->once())
->method('setDataByPath')
Expand Down
5 changes: 5 additions & 0 deletions app/code/Magento/ImportExport/Model/Import.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ class Import extends \Magento\ImportExport\Model\AbstractModel
*/
protected $_importExportData = null;

/**
* @var \Magento\Framework\App\Config\ScopeConfigInterface
*/
private $_coreConfig;

/**
* @var \Magento\ImportExport\Model\Import\ConfigInterface
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
-->
<include xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_include.xsd">
<group id="paypal_payflowpro_with_express_checkout" translate="label comment" extends="payment_all_paypal/paypal_payflowpro">
<group id="paypal_payflowpro_with_express_checkout" translate="label" extends="payment_all_paypal/paypal_payflowpro">
<label>Payflow Pro</label>
<attribute type="paypal_ec_separate">0</attribute>
<group id="paypal_payflow_required" translate="label" showInDefault="1" showInWebsite="1" sortOrder="10">
Expand All @@ -30,7 +30,7 @@
<field id="enable_paypal_payflow"/>
</requires>
</field>
<field id="enable_express_checkout_bml_payflow" translate="label" type="select" sortOrder="21" showInWebsite="1" showInDefault="1">
<field id="enable_express_checkout_bml_payflow" translate="label comment" type="select" sortOrder="21" showInWebsite="1" showInDefault="1">
<label>Enable PayPal Credit</label>
<comment><![CDATA[PayPal Express Checkout Payflow Edition lets you give customers access to financing through PayPal Credit&#174; - at no additional cost to you.
You get paid up front, even though customers have more time to pay. A pre-integrated payment button lets customers pay quickly with PayPal Credit&#174;.
Expand Down
7 changes: 6 additions & 1 deletion app/code/Magento/Paypal/i18n/en_US.csv
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,11 @@ User,User
The PayPal Advertising Program has been shown to generate additional purchases as well as increase consumer's average purchase sizes by 15%
or more. <a href=""https://financing.paypal.com/ppfinportal/content/forrester"" target=""_blank"">See Details</a>.
"
"PayPal Express Checkout Payflow Edition lets you give customers access to financing through PayPal Credit&#174; - at no additional cost to you.
You get paid up front, even though customers have more time to pay. A pre-integrated payment button lets customers pay quickly with PayPal Credit&#174;.
<a href=""https://www.paypal.com/webapps/mpp/promotional-financing"" target=""_blank"">Learn More</a>","PayPal Express Checkout Payflow Edition lets you give customers access to financing through PayPal Credit&#174; - at no additional cost to you.
You get paid up front, even though customers have more time to pay. A pre-integrated payment button lets customers pay quickly with PayPal Credit&#174;.
<a href=""https://www.paypal.com/webapps/mpp/promotional-financing"" target=""_blank"">Learn More</a>"
"Customize Smart Buttons","Customize Smart Buttons"
"Checkout Page","Checkout Page"
"Label","Label"
Expand Down Expand Up @@ -731,4 +736,4 @@ User,User
"PayPal will automatically display each enabled funding option to eligible buyers. For example, PayPal Credit is only shown to buyers in countries where PayPal Credit is offered and the currency offered by the merchant is USD.","PayPal will automatically display each enabled funding option to eligible buyers. For example, PayPal Credit is only shown to buyers in countries where PayPal Credit is offered and the currency offered by the merchant is USD."
"PayPal Credit","PayPal Credit"
"PayPal Guest Checkout Credit Card Icons","PayPal Guest Checkout Credit Card Icons"
"Elektronisches Lastschriftverfahren - German ELV","Elektronisches Lastschriftverfahren - German ELV"
"Elektronisches Lastschriftverfahren - German ELV","Elektronisches Lastschriftverfahren - German ELV"
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<test name="AdminUpdateCategoryUrlRewriteAndAddTemporaryRedirectTest">
<annotations>
<stories value="Update URL rewrite"/>
<title value="Update Category URL Rewrites, no redirect type"/>
<title value="Update Category URL Rewrites, Temporary redirect type"/>
<description value="Login as Admin and update category UrlRewrite and add Temporary redirect type"/>
<testCaseId value="MC-5356"/>
<severity value="CRITICAL"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,20 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Paypal\Model\Config\Structure\Reader;
declare(strict_types=1);

namespace Magento\Config\Model\Config\Structure\Reader;

use Magento\Config\Model\Config\Structure\Converter;

/**
* Class ConverterStub
* Class ConverterStub used for ReaderTest.
*/
class ConverterStub extends \Magento\Config\Model\Config\Structure\Converter
class ConverterStub extends Converter
{
/**
* Convert dom document wrapper.
*
* @param \DOMDocument $document
* @return array|null
*/
Expand All @@ -20,7 +26,7 @@ public function getArrayData(\DOMDocument $document)
}

/**
* Convert dom document
* Convert dom document.
*
* @param \DOMNode $source
* @return array
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,20 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Paypal\Model\Config\Structure\Reader;
declare(strict_types=1);

namespace Magento\Config\Model\Config\Structure\Reader;

use Magento\Config\Model\Config\Structure\Reader;

/**
* Class ReaderStub
* Class ReaderStub used for testing protected Reader::_readFiles() method.
*/
class ReaderStub extends \Magento\Config\Model\Config\Structure\Reader
class ReaderStub extends Reader
{
/**
* Wrapper for protected Reader::_readFiles() method.
*
* @param array $fileList
* @return array
* @throws \Magento\Framework\Exception\LocalizedException
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\Config\Model\Config\Structure\Reader;

use Magento\Config\Model\Config\SchemaLocator;
use Magento\Framework\App\Utility\Files;
use Magento\Framework\Config\Dom;
use Magento\Framework\Config\FileResolverInterface;
use Magento\Framework\Config\ValidationStateInterface;
use Magento\Framework\ObjectManagerInterface;
use Magento\Framework\View\TemplateEngine\Xhtml\CompilerInterface;
use Magento\TestFramework\Helper\Bootstrap;

/**
* Class ReaderTest check Magento\Config\Model\Config\Structure\Reader::_readFiles() method.
*/
class ReaderTest extends \PHPUnit\Framework\TestCase
{
/**
* Test config location.
*
* @string
*/
const CONFIG = '/dev/tests/integration/testsuite/Magento/Config/Model/Config/Structure/Reader/_files/';

/**
* @var ObjectManagerInterface
*/
private $objectManager;

/**
* @var Files
*/
private $fileUtility;

/**
* @var ValidationStateInterface
*/
private $validationStateMock;

/**
* @var \Magento\Framework\Config\SchemaLocatorInterface
*/
private $schemaLocatorMock;

/**
* @var FileResolverInterface
*/
private $fileResolverMock;

/**
* @var ReaderStub
*/
private $reader;

/**
* @var ConverterStub
*/
private $converter;

/**
* @var CompilerInterface|\PHPUnit_Framework_MockObject_MockObject
*/
private $compiler;

/**
* @inheritdoc
*/
protected function setUp()
{
$this->objectManager = Bootstrap::getObjectManager();
$this->fileUtility = Files::init();

$this->validationStateMock = $this->getMockBuilder(ValidationStateInterface::class)
->setMethods(['isValidationRequired'])
->getMockForAbstractClass();
$this->schemaLocatorMock = $this->getMockBuilder(SchemaLocator::class)
->disableOriginalConstructor()
->setMethods(['getPerFileSchema'])
->getMock();
$this->fileResolverMock = $this->getMockBuilder(FileResolverInterface::class)
->getMockForAbstractClass();

$this->validationStateMock->expects($this->atLeastOnce())
->method('isValidationRequired')
->willReturn(false);
$this->schemaLocatorMock->expects($this->atLeastOnce())
->method('getPerFileSchema')
->willReturn(false);

$this->converter = $this->objectManager->create(ConverterStub::class);

//Isolate test from actual configuration, and leave only sample data.
$this->compiler = $this->getMockBuilder(CompilerInterface::class)
->disableOriginalConstructor()
->setMethods(['compile'])
->getMockForAbstractClass();

$this->reader = $this->objectManager->create(
ReaderStub::class,
[
'fileResolver' => $this->fileResolverMock,
'converter' => $this->converter,
'schemaLocator' => $this->schemaLocatorMock,
'validationState' => $this->validationStateMock,
'fileName' => 'no_existing_file.xml',
'compiler' => $this->compiler,
'domDocumentClass' => Dom::class
]
);
}

/**
* The test checks the file structure after processing the nodes responsible for inserting content.
*
* @return void
*/
public function testXmlConvertedConfigurationAndCompereStructure()
{
$actual = $this->reader->readFiles(['actual' => $this->getContent()]);

$document = new \DOMDocument();
$document->loadXML($this->getContent());

$expected = $this->converter->getArrayData($document);

$this->assertEquals($expected, $actual);
}

/**
* Get config sample data for test.
*
* @return string
*/
protected function getContent()
{
$files = $this->fileUtility->getFiles([BP . static::CONFIG], 'config.xml');

return file_get_contents(reset($files));
}
}
Loading

0 comments on commit 6bbd681

Please sign in to comment.