Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:magento/magento2ce into troll_p2
Browse files Browse the repository at this point in the history
  • Loading branch information
rganin committed Jul 13, 2016
2 parents 3cc4e0d + c20c8e9 commit 77ad0b4
Show file tree
Hide file tree
Showing 193 changed files with 2,222 additions and 555 deletions.
6 changes: 3 additions & 3 deletions app/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
#ini_set('display_errors', 1);

/* PHP version validation */
if (!defined('PHP_VERSION_ID') || !(PHP_VERSION_ID >= 50600 && PHP_VERSION_ID < 50700 || PHP_VERSION_ID === 70002 || PHP_VERSION_ID >= 70006)) {
if (!defined('PHP_VERSION_ID') || !(PHP_VERSION_ID >= 50600 && PHP_VERSION_ID < 50700 || PHP_VERSION_ID === 70002 || PHP_VERSION_ID === 70004 || PHP_VERSION_ID >= 70006)) {
if (PHP_SAPI == 'cli') {
echo 'Magento supports PHP 5.6, 7.0.2, and 7.0.6 or later. ' .
echo 'Magento supports PHP 5.6, 7.0.2, 7.0.4, and 7.0.6 or later. ' .
'Please read http://devdocs.magento.com/guides/v1.0/install-gde/system-requirements.html';
} else {
echo <<<HTML
<div style="font:12px/1.35em arial, helvetica, sans-serif;">
<p>Magento supports PHP 5.6, 7.0.2, and 7.0.6 or later. Please read
<p>Magento supports PHP 5.6, 7.0.2, 7.0.4, and 7.0.6 or later. Please read
<a target="_blank" href="http://devdocs.magento.com/guides/v1.0/install-gde/system-requirements.html">
Magento System Requirements</a>.
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/AdminNotification/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "magento/module-admin-notification",
"description": "N/A",
"require": {
"php": "~5.6.0|7.0.2|~7.0.6",
"php": "~5.6.0|7.0.2|7.0.4|~7.0.6",
"magento/module-store": "100.2.*",
"magento/module-backend": "100.2.*",
"magento/module-media-storage": "100.2.*",
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/AdvancedPricingImportExport/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "magento/module-advanced-pricing-import-export",
"description": "N/A",
"require": {
"php": "~5.6.0|7.0.2|~7.0.6",
"php": "~5.6.0|7.0.2|7.0.4|~7.0.6",
"magento/module-catalog": "101.1.*",
"magento/module-catalog-inventory": "100.2.*",
"magento/module-eav": "100.2.*",
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Authorization/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "magento/module-authorization",
"description": "Authorization module provides access to Magento ACL functionality.",
"require": {
"php": "~5.6.0|7.0.2|~7.0.6",
"php": "~5.6.0|7.0.2|7.0.4|~7.0.6",
"magento/module-backend": "100.2.*",
"magento/framework": "100.2.*"
},
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Authorizenet/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "magento/module-authorizenet",
"description": "N/A",
"require": {
"php": "~5.6.0|7.0.2|~7.0.6",
"php": "~5.6.0|7.0.2|7.0.4|~7.0.6",
"magento/module-sales": "100.2.*",
"magento/module-store": "100.2.*",
"magento/module-quote": "100.2.*",
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Backend/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "magento/module-backend",
"description": "N/A",
"require": {
"php": "~5.6.0|7.0.2|~7.0.6",
"php": "~5.6.0|7.0.2|7.0.4|~7.0.6",
"magento/module-store": "100.2.*",
"magento/module-directory": "100.2.*",
"magento/module-developer": "100.2.*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ CountryModel.prototype = {
var showMethodElement = $(applyCountryElement.id.replace(/sallowspecific/, 'showmethod'));
//var specifErrMsgElement = $(applyCountryElement.id.replace(/sallowspecific/, 'specificerrmsg'));
if (specifCountryElement) {
if (applyCountryElement.value == 1) {
if (applyCountryElement.value == 1 && !specifCountryElement.hasAttribute('disabled')) {
//if specific country element selected
specifCountryElement.enable();
if (showMethodElement) {
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Backup/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "magento/module-backup",
"description": "N/A",
"require": {
"php": "~5.6.0|7.0.2|~7.0.6",
"php": "~5.6.0|7.0.2|7.0.4|~7.0.6",
"magento/module-store": "100.2.*",
"magento/module-backend": "100.2.*",
"magento/module-cron": "100.2.*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,13 @@ public function setCustomAttribute($attributeCode, $attributeValue)
*/
public function getCustomAttributes()
{
$shouldBeLocalized = ['paymentInstrumentType', 'type', 'status'];
$output = [];
foreach ($this->getMappedValues() as $key => $value) {
$attribute = $this->attributeValueFactory->create();
if(in_array($key, $shouldBeLocalized)) {
$value = __($value);
}
$output[] = $attribute->setAttributeCode($key)->setValue($value);
}
return $output;
Expand Down
1 change: 0 additions & 1 deletion app/code/Magento/Braintree/Model/Ui/ConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ public function getConfig()
'payment' => [
self::CODE => [
'isActive' => $this->config->isActive(),
'isSingleUse' => !$isPayPalActive,
'clientToken' => $this->getClientToken(),
'ccTypesMapper' => $this->config->getCctypesMapper(),
'sdkUrl' => $this->config->getSdkUrl(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
use Magento\Braintree\Model\Report\Row\TransactionMap;
use Magento\Framework\Api\AttributeValue;
use Magento\Framework\Api\AttributeValueFactory;
use Magento\Framework\Phrase;
use Magento\Framework\Phrase\RendererInterface;
use Magento\Store\Model\StoreManagerInterface;

/**
Expand All @@ -30,6 +32,16 @@ class TransactionMapTest extends \PHPUnit_Framework_TestCase
*/
private $attributeValueFactoryMock;

/**
* @var RendererInterface|\PHPUnit_Framework_MockObject_MockObject
*/
private $defaultRenderer;

/**
* @var RendererInterface|\PHPUnit_Framework_MockObject_MockObject
*/
private $rendererMock;

/**
* Setup
*/
Expand All @@ -39,6 +51,9 @@ protected function setUp()
->setMethods(['create'])
->disableOriginalConstructor()
->getMock();
$this->defaultRenderer = Phrase::getRenderer();
$this->rendererMock = $this->getMockBuilder(RendererInterface::class)
->getMock();
}

/**
Expand All @@ -65,6 +80,8 @@ public function testGetCustomAttributes($transaction)
$this->transactionStub
);

Phrase::setRenderer($this->rendererMock);

/** @var AttributeValue[] $result */
$result = $map->getCustomAttributes();

Expand All @@ -77,6 +94,31 @@ public function testGetCustomAttributes($transaction)
$result[6]->getValue()
);
$this->assertEquals(implode(', ', $transaction['refundIds']), $result[11]->getValue());
$this->assertEquals($transaction['merchantAccountId'], $result[1]->getValue());
$this->assertEquals($transaction['orderId'], $result[2]->getValue());
$this->assertEquals($transaction['amount'], $result[7]->getValue());
$this->assertEquals($transaction['processorSettlementResponseCode'], $result[8]->getValue());
$this->assertEquals($transaction['processorSettlementResponseText'], $result[10]->getValue());
$this->assertEquals($transaction['settlementBatchId'], $result[12]->getValue());
$this->assertEquals($transaction['currencyIsoCode'], $result[13]->getValue());

$this->rendererMock->expects($this->at(0))
->method('render')
->with([$transaction['paymentInstrumentType']])
->willReturn('Credit card');
$this->assertEquals('Credit card', $result[3]->getValue()->render());

$this->rendererMock->expects($this->at(0))
->method('render')
->with([$transaction['type']])
->willReturn('Sale');
$this->assertEquals('Sale', $result[5]->getValue()->render());

$this->rendererMock->expects($this->at(0))
->method('render')
->with([$transaction['status']])
->willReturn('Pending for settlement');
$this->assertEquals('Pending for settlement', $result[9]->getValue()->render());
}

/**
Expand All @@ -90,9 +132,27 @@ public function getConfigDataProvider()
'id' => 1,
'createdAt' => new \DateTime(),
'paypalDetails' => new PayPalDetails(['paymentId' => 10]),
'refundIds' => [1, 2, 3, 4, 5]
'refundIds' => [1, 2, 3, 4, 5],
'merchantAccountId' => 'MerchantId',
'orderId' => 1,
'paymentInstrumentType' => 'credit_card',
'type' => 'sale',
'amount' => '$19.99',
'processorSettlementResponseCode' => 1,
'status' => 'pending_for_settlement',
'processorSettlementResponseText' => 'sample text',
'settlementBatchId' => 2,
'currencyIsoCode' => 'USD'
]
]
];
}

/**
* @return void
*/
protected function tearDown()
{
Phrase::setRenderer($this->defaultRenderer);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -184,4 +184,42 @@ public function testGetItemsWithNullLimit()
$this->assertEquals(TransactionsCollection::TRANSACTION_MAXIMUM_COUNT, count($items));
$this->assertInstanceOf(DocumentInterface::class, $items[1]);
}

/**
* Add fields to filter
*
* @dataProvider addToFilterDataProvider
*/
public function testAddToFilter($field, $condition, $filterMapperCall, $expectedCondition)
{
$this->filterMapperMock->expects(static::exactly($filterMapperCall))
->method('getFilter')
->with($field, $expectedCondition)
->willReturn(new BraintreeSearchNodeStub());

$collection = new TransactionsCollection(
$this->entityFactoryMock,
$this->braintreeAdapterMock,
$this->filterMapperMock
);

static::assertInstanceOf(
TransactionsCollection::class,
$collection->addFieldToFilter($field, $condition)
);
}

/**
* addToFilter DataProvider
*
* @return array
*/
public function addToFilterDataProvider()
{
return [
['orderId', ['like' => 1], 1, ['like' => 1]],
['type', 'sale', 1, ['eq' => 'sale']],
[['type', 'orderId'], [], 0, []],
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ public function getConfigDataProvider()
'payment' => [
ConfigProvider::CODE => [
'isActive' => true,
'isSingleUse' => false,
'clientToken' => self::CLIENT_TOKEN,
'ccTypesMapper' => ['visa' => 'VI', 'american-express' => 'AE'],
'sdkUrl' => self::SDK_URL,
Expand Down
Loading

0 comments on commit 77ad0b4

Please sign in to comment.