Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…gento2ce into develop
  • Loading branch information
Dmytro Aponasenko committed Oct 21, 2015
2 parents 85b6197 + 222b77c commit cc2c0c7
Show file tree
Hide file tree
Showing 103 changed files with 2,425 additions and 1,140 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,25 @@ public function render(\Magento\Framework\DataObject $row)
{
$values = $this->_getValues();
$value = $row->getData($this->getColumn()->getIndex());
$checked = '';
if (is_array($values)) {
$checked = in_array($value, $values) ? ' checked="checked"' : '';
} else {
$checked = $value === $this->getColumn()->getValue() ? ' checked="checked"' : '';
$checkedValue = $this->getColumn()->getValue();
if ($checkedValue !== null) {
$checked = $value === $checkedValue ? ' checked="checked"' : '';
}
}

$disabled = '';
$disabledValues = $this->getColumn()->getDisabledValues();
if (is_array($disabledValues)) {
$disabled = in_array($value, $disabledValues) ? ' disabled="disabled"' : '';
} else {
$disabled = $value === $this->getColumn()->getDisabledValue() ? ' disabled="disabled"' : '';
$disabledValue = $this->getColumn()->getDisabledValue();
if ($disabledValue !== null) {
$disabled = $value === $disabledValue ? ' disabled="disabled"' : '';
}
}

$this->setDisabled($disabled);
Expand Down
16 changes: 8 additions & 8 deletions app/code/Magento/Backend/Model/Session/AdminConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ class AdminConfig extends Config
protected $_frontNameResolver;

/**
* @var \Magento\Store\Model\StoreManagerInterface
* @var \Magento\Backend\App\BackendAppList
*/
protected $_storeManager;
private $backendAppList;

/**
* @var \Magento\Backend\App\BackendAppList
* @var \Magento\Backend\Model\UrlFactory
*/
private $backendAppList;
private $backendUrlFactory;

/**
* @param \Magento\Framework\ValidatorFactory $validatorFactory
Expand All @@ -49,7 +49,7 @@ class AdminConfig extends Config
* @param string $scopeType
* @param \Magento\Backend\App\BackendAppList $backendAppList
* @param FrontNameResolver $frontNameResolver
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
* @param \Magento\Backend\Model\UrlFactory $backendUrlFactory
* @param string $lifetimePath
* @param string $sessionName
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
Expand All @@ -64,7 +64,7 @@ public function __construct(
$scopeType,
\Magento\Backend\App\BackendAppList $backendAppList,
FrontNameResolver $frontNameResolver,
\Magento\Store\Model\StoreManagerInterface $storeManager,
\Magento\Backend\Model\UrlFactory $backendUrlFactory,
$lifetimePath = self::XML_PATH_COOKIE_LIFETIME,
$sessionName = self::SESSION_NAME_ADMIN
) {
Expand All @@ -79,8 +79,8 @@ public function __construct(
$lifetimePath
);
$this->_frontNameResolver = $frontNameResolver;
$this->_storeManager = $storeManager;
$this->backendAppList = $backendAppList;
$this->backendUrlFactory = $backendUrlFactory;
$adminPath = $this->extractAdminPath();
$this->setCookiePath($adminPath);
$this->setName($sessionName);
Expand All @@ -95,7 +95,7 @@ private function extractAdminPath()
{
$backendApp = $this->backendAppList->getCurrentApp();
$cookiePath = null;
$baseUrl = parse_url($this->_storeManager->getStore()->getBaseUrl(), PHP_URL_PATH);
$baseUrl = parse_url($this->backendUrlFactory->create()->getBaseUrl(), PHP_URL_PATH);
if (!$backendApp) {
$cookiePath = $baseUrl . $this->_frontNameResolver->getFrontName();
return $cookiePath;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ class AdminConfigTest extends \PHPUnit_Framework_TestCase
private $objectManager;

/**
* @var \Magento\Store\Model\StoreManagerInterface | \PHPUnit_Framework_MockObject_MockObject
* @var \Magento\Backend\Model\UrlFactory | \PHPUnit_Framework_MockObject_MockObject
*/
private $storeManagerMock;
private $backendUrlFactory;

/**
* @var \Magento\Framework\Filesystem|\PHPUnit_Framework_MockObject_MockObject
Expand All @@ -56,13 +56,10 @@ protected function setUp()
$this->validatorFactory = $this->getMockBuilder('Magento\Framework\ValidatorFactory')
->disableOriginalConstructor()
->getMock();

$storeMock = $this->getMockBuilder('\Magento\Store\Model\Store')
->disableOriginalConstructor()
->getMock();
$storeMock->expects($this->once())->method('getBaseUrl')->will($this->returnValue('/'));
$this->storeManagerMock = $this->getMockForAbstractClass('\Magento\Store\Model\StoreManagerInterface');
$this->storeManagerMock->expects($this->once())->method('getStore')->will($this->returnValue($storeMock));
$backendUrl = $this->getMock('\Magento\Backend\Model\Url', [], [], '', false);
$backendUrl->expects($this->once())->method('getBaseUrl')->will($this->returnValue('/'));
$this->backendUrlFactory = $this->getMock('Magento\Backend\Model\UrlFactory', ['create'], [], '', false);
$this->backendUrlFactory->expects($this->any())->method('create')->willReturn($backendUrl);

$this->filesystemMock = $this->getMock('\Magento\Framework\Filesystem', [], [], '', false);
$dirMock = $this->getMockForAbstractClass('Magento\Framework\Filesystem\Directory\WriteInterface');
Expand Down Expand Up @@ -99,7 +96,7 @@ public function testSetCookiePathNonDefault()
'validatorFactory' => $this->validatorFactory,
'request' => $this->requestMock,
'frontNameResolver' => $mockFrontNameResolver,
'storeManager' => $this->storeManagerMock,
'backendUrlFactory' => $this->backendUrlFactory,
'filesystem' => $this->filesystemMock,
]
);
Expand Down Expand Up @@ -134,7 +131,7 @@ public function testSetSessionNameByConstructor()
'validatorFactory' => $this->validatorFactory,
'request' => $this->requestMock,
'sessionName' => $sessionName,
'storeManager' => $this->storeManagerMock,
'backendUrlFactory' => $this->backendUrlFactory,
'filesystem' => $this->filesystemMock,
]
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ if (!isset($advancedLabel)) {
$advancedLabel = __('Additional Settings');
}

$cssClass = ($isField) ? 'field ' . $element->getClass() : 'fieldset admin__fieldset' . $element->getClass();
$cssClass = ($isField) ? 'field ' . $element->getClass() : 'fieldset admin__fieldset ' . $element->getClass();

if ($isField) {
$count = $element->getCountBasicChildren();
Expand Down
3 changes: 3 additions & 0 deletions app/code/Magento/Braintree/Model/PaymentMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use \Braintree_Transaction;
use \Braintree_Result_Successful;
use Magento\Framework\Exception\LocalizedException;
use Magento\Sales\Model\Order\Payment\Transaction;
use Magento\Sales\Model\ResourceModel\Order\Payment\Transaction\CollectionFactory as TransactionCollectionFactory;
use Magento\Sales\Model\Order\Payment\Transaction as PaymentTransaction;
use Magento\Payment\Model\InfoInterface;
Expand Down Expand Up @@ -648,13 +649,15 @@ public function refund(InfoInterface $payment, $amount)
}
}

// transaction should be voided if it not settled
$canVoid = ($transaction->status === \Braintree_Transaction::AUTHORIZED
|| $transaction->status === \Braintree_Transaction::SUBMITTED_FOR_SETTLEMENT);
$result = $canVoid
? $this->braintreeTransaction->void($transactionId)
: $this->braintreeTransaction->refund($transactionId, $amount);
$this->_debug($this->_convertObjToArray($result));
if ($result->success) {
$payment->setTransactionId($transactionId . '-' . Transaction::TYPE_REFUND);
$payment->setIsTransactionClosed(true);
} else {
throw new LocalizedException($this->errorHelper->parseBraintreeError($result));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

use Magento\Braintree\Model\PaymentMethod;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
use Magento\Sales\Model\Order\Payment\Transaction;
use \Magento\Sales\Model\ResourceModel\Order\Payment\Transaction\CollectionFactory as TransactionCollectionFactory;
use Magento\Framework\Exception\LocalizedException;
use \Braintree_Result_Successful;
Expand Down Expand Up @@ -2378,6 +2379,7 @@ public function testRefund()

$this->model->refund($paymentObject, $amount);
$this->assertEquals(1, $paymentObject->getIsTransactionClosed());
$this->assertEquals($refundTransactionId . '-' .Transaction::TYPE_REFUND, $paymentObject->getTransactionId());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ $ccExpYear = $block->getInfoData('cc_exp_year');
</div>
</fieldset>
<?php endif; ?>
<?php if($_useVault): ?>
<?php if($useVault): ?>
<fieldset class="admin__fieldset hide_if_token_selected">
<div id="<?php /* @noEscape */ echo $code; ?>_store_in_vault_div" style="text-align:left;" class="">
<input type="checkbox" title="<?php echo $block->escapeHtml(__('Save this card for future use')); ?>"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ $storedCards = $block->getCurrentCustomerStoredCards();
<?php endif; ?>
</div>
<?php echo $block->getLayout()->getMessagesBlock()->getGroupedHtml(); ?>
<?php if (count($_storedCards)): ?>
<?php if (count($storedCards)): ?>
<table class="data-table" id="my-quotes-table">
<col width="1" />
<col width="1" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@
<!-- ko if: (isCcDetectionEnabled())-->
<ul class="credit-card-types">
<!-- ko foreach: {data: getCcAvailableTypesValues(), as: 'item'} -->
<li class="item" data-bind="css: {_active: $parent.selectedCardType() == item.value} ">
<li class="item" data-bind="css: {
_active: $parent.selectedCardType() == item.value,
_inactive: $parent.selectedCardType() != null && $parent.selectedCardType() != item.value
} ">
<!--ko if: $parent.getIcons(item.value) -->
<img data-bind="attr: {
'src': $parent.getIcons(item.value).url,
Expand Down
5 changes: 5 additions & 0 deletions app/code/Magento/Catalog/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,11 @@
</argument>
</arguments>
</type>
<type name="Magento\Catalog\Console\Command\ImagesResizeCommand">
<arguments>
<argument name="productRepository" xsi:type="object">Magento\Catalog\Api\ProductRepositoryInterface\Proxy</argument>
</arguments>
</type>
<type name="Magento\Framework\Config\View">
<arguments>
<argument name="xpath" xsi:type="array">
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Cookie/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "magento/module-cookie",
"description": "N/A",
"require": {
"php": "~5.4.11|~5.5.0|~5.6.0",
"php": "~5.5.0|~5.6.0|~7.0.0",
"magento/module-store": "1.0.0-beta",
"magento/framework": "1.0.0-beta"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ public function __construct(
) {
parent::__construct();
$this->customerCollectionFactory = $customerCollectionFactory;
$this->collection = $customerCollectionFactory->create();
$this->encryptor = $encryptor;
}

Expand All @@ -58,6 +57,7 @@ protected function configure()
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->collection = $this->customerCollectionFactory->create();
$this->collection->addAttributeToSelect('*');
$customerCollection = $this->collection->getItems();
/** @var $customer Customer */
Expand Down
Loading

0 comments on commit cc2c0c7

Please sign in to comment.