Skip to content

Commit fef4a88

Browse files
committed
Merge branch 'develop' of github.com:magento/magento2ce into MAGETWO-55449
2 parents d71e87a + 532dcd5 commit fef4a88

File tree

192 files changed

+6315
-940
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

192 files changed

+6315
-940
lines changed

.htaccess

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -32,34 +32,6 @@
3232

3333
DirectoryIndex index.php
3434

35-
<IfModule mod_php5.c>
36-
37-
############################################
38-
## adjust memory limit
39-
40-
php_value memory_limit 768M
41-
php_value max_execution_time 18000
42-
43-
############################################
44-
## disable automatic session start
45-
## before autoload was initialized
46-
47-
php_flag session.auto_start off
48-
49-
############################################
50-
## enable resulting html compression
51-
52-
#php_flag zlib.output_compression on
53-
54-
###########################################
55-
## disable user agent verification to not break multiple image upload
56-
57-
php_flag suhosin.session.cryptua off
58-
59-
</IfModule>
60-
61-
<IfModule mod_php7.c>
62-
6335
############################################
6436
## adjust memory limit
6537

@@ -82,8 +54,6 @@
8254

8355
php_flag suhosin.session.cryptua off
8456

85-
</IfModule>
86-
8757
<IfModule mod_security.c>
8858
###########################################
8959
## disable POST processing to not break multiple image upload

.htaccess.sample

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -32,34 +32,6 @@
3232

3333
DirectoryIndex index.php
3434

35-
<IfModule mod_php5.c>
36-
37-
############################################
38-
## adjust memory limit
39-
40-
php_value memory_limit 768M
41-
php_value max_execution_time 18000
42-
43-
############################################
44-
## disable automatic session start
45-
## before autoload was initialized
46-
47-
php_flag session.auto_start off
48-
49-
############################################
50-
## enable resulting html compression
51-
52-
#php_flag zlib.output_compression on
53-
54-
###########################################
55-
## disable user agent verification to not break multiple image upload
56-
57-
php_flag suhosin.session.cryptua off
58-
59-
</IfModule>
60-
61-
<IfModule mod_php7.c>
62-
6335
############################################
6436
## adjust memory limit
6537

@@ -82,8 +54,6 @@
8254

8355
php_flag suhosin.session.cryptua off
8456

85-
</IfModule>
86-
8757
<IfModule mod_security.c>
8858
###########################################
8959
## disable POST processing to not break multiple image upload

app/code/Magento/Authorizenet/Model/Source/Cctype.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ class Cctype extends PaymentCctype
1717
*/
1818
public function getAllowedTypes()
1919
{
20-
return ['VI', 'MC', 'AE', 'DI', 'OT'];
20+
return ['VI', 'MC', 'AE', 'DI'];
2121
}
2222
}

app/code/Magento/Backup/Cron/SystemBackup.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ public function __construct(
9797
* Create Backup
9898
*
9999
* @return $this
100+
* @throws \Exception
100101
*/
101102
public function execute()
102103
{
@@ -138,8 +139,7 @@ public function execute()
138139
} catch (\Exception $e) {
139140
$this->_errors[] = $e->getMessage();
140141
$this->_errors[] = $e->getTrace();
141-
$this->_logger->info($e->getMessage());
142-
$this->_logger->critical($e);
142+
throw $e;
143143
}
144144

145145
if ($this->_scopeConfig->isSetFlag(self::XML_PATH_BACKUP_MAINTENANCE_MODE, ScopeInterface::SCOPE_STORE)) {
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Backup\Test\Unit\Cron;
7+
8+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
9+
10+
class SystemBackupTest extends \PHPUnit_Framework_TestCase
11+
{
12+
/**
13+
* @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager
14+
*/
15+
private $objectManager;
16+
17+
/**
18+
* @var \Magento\Backup\Cron\SystemBackup
19+
*/
20+
private $systemBackup;
21+
22+
/**
23+
* @var \Magento\Framework\App\Config\ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject
24+
*/
25+
private $scopeConfigMock;
26+
27+
/**
28+
* @var \Magento\Backup\Helper\Data|\PHPUnit_Framework_MockObject_MockObject
29+
*/
30+
private $backupDataMock;
31+
32+
/**
33+
* @var \Magento\Framework\Registry|\PHPUnit_Framework_MockObject_MockObject
34+
*/
35+
private $registryMock;
36+
37+
/**
38+
* @var \Psr\Log\LoggerInterface|\PHPUnit_Framework_MockObject_MockObject
39+
*/
40+
private $loggerMock;
41+
42+
/**
43+
* Filesystem facade
44+
*
45+
* @var \Magento\Framework\Filesystem|\PHPUnit_Framework_MockObject_MockObject
46+
*/
47+
private $filesystemMock;
48+
49+
/**
50+
* @var \Magento\Framework\Backup\Factory|\PHPUnit_Framework_MockObject_MockObject
51+
*/
52+
private $backupFactoryMock;
53+
54+
/**
55+
* @var \Magento\Framework\App\MaintenanceMode|\PHPUnit_Framework_MockObject_MockObject
56+
*/
57+
private $maintenanceModeMock;
58+
59+
/**
60+
* @var \Magento\Framework\Backup\Db|\PHPUnit_Framework_MockObject_MockObject
61+
*/
62+
private $backupDbMock;
63+
64+
/**
65+
* @var \Magento\Framework\ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject
66+
*/
67+
private $objectManagerMock;
68+
69+
protected function setUp()
70+
{
71+
$this->objectManagerMock = $this->getMockBuilder(\Magento\Framework\ObjectManagerInterface::class)
72+
->getMock();
73+
$this->scopeConfigMock = $this->getMockBuilder(\Magento\Framework\App\Config\ScopeConfigInterface::class)
74+
->getMock();
75+
$this->backupDataMock = $this->getMockBuilder(\Magento\Backup\Helper\Data::class)
76+
->disableOriginalConstructor()
77+
->getMock();
78+
$this->registryMock = $this->getMockBuilder(\Magento\Framework\Registry::class)
79+
->disableOriginalConstructor()
80+
->getMock();
81+
$this->loggerMock = $this->getMockBuilder(\Psr\Log\LoggerInterface::class)
82+
->getMock();
83+
$this->filesystemMock = $this->getMockBuilder(\Magento\Framework\Filesystem::class)
84+
->disableOriginalConstructor()
85+
->getMock();
86+
$this->backupFactoryMock = $this->getMockBuilder(\Magento\Framework\Backup\Factory::class)
87+
->disableOriginalConstructor()
88+
->getMock();
89+
$this->maintenanceModeMock = $this->getMockBuilder(\Magento\Framework\App\MaintenanceMode::class)
90+
->disableOriginalConstructor()
91+
->getMock();
92+
93+
$this->backupDbMock = $this->getMockBuilder(\Magento\Framework\Backup\Db::class)
94+
->disableOriginalConstructor()
95+
->getMock();
96+
$this->backupDbMock->expects($this->any())->method('setBackupExtension')->willReturnSelf();
97+
$this->backupDbMock->expects($this->any())->method('setTime')->willReturnSelf();
98+
$this->backupDbMock->expects($this->any())->method('setBackupsDir')->willReturnSelf();
99+
100+
$this->objectManager = new ObjectManager($this);
101+
$this->systemBackup = $this->objectManager->getObject(
102+
\Magento\Backup\Cron\SystemBackup::class,
103+
[
104+
'backupData' => $this->backupDataMock,
105+
'coreRegistry' => $this->registryMock,
106+
'logger' => $this->loggerMock,
107+
'scopeConfig' => $this->scopeConfigMock,
108+
'filesystem' => $this->filesystemMock,
109+
'backupFactory' => $this->backupFactoryMock,
110+
'maintenanceMode' => $this->maintenanceModeMock,
111+
]
112+
);
113+
}
114+
115+
/**
116+
* @expectedException \Exception
117+
*/
118+
public function testExecuteThrowsException()
119+
{
120+
$type = 'db';
121+
$this->scopeConfigMock->expects($this->any())->method('isSetFlag')->willReturn(true);
122+
123+
$this->scopeConfigMock->expects($this->once())->method('getValue')
124+
->with('system/backup/type', 'store')
125+
->willReturn($type);
126+
127+
$this->backupFactoryMock->expects($this->once())->method('create')->willReturn($this->backupDbMock);
128+
129+
$this->backupDbMock->expects($this->once())->method('create')->willThrowException(new \Exception);
130+
131+
$this->backupDataMock->expects($this->never())->method('getCreateSuccessMessageByType')->with($type);
132+
$this->loggerMock->expects($this->never())->method('info');
133+
134+
$this->systemBackup->execute();
135+
}
136+
}
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Braintree\Block\Customer\PayPal;
7+
8+
use Magento\Braintree\Gateway\Config\PayPal\Config;
9+
use Magento\Braintree\Model\Ui\PayPal\ConfigProvider;
10+
use Magento\Framework\View\Element\Template;
11+
use Magento\Vault\Api\Data\PaymentTokenInterface;
12+
use Magento\Vault\Block\AbstractTokenRenderer;
13+
14+
/**
15+
* Class VaultTokenRenderer
16+
*/
17+
class VaultTokenRenderer extends AbstractTokenRenderer
18+
{
19+
/**
20+
* @var Config
21+
*/
22+
private $config;
23+
24+
public function __construct(
25+
Template\Context $context,
26+
Config $config,
27+
array $data = []
28+
) {
29+
parent::__construct($context, $data);
30+
$this->config = $config;
31+
}
32+
33+
/**
34+
* @inheritdoc
35+
*/
36+
public function getIconUrl()
37+
{
38+
return $this->config->getPayPalIcon()['url'];
39+
}
40+
41+
/**
42+
* @inheritdoc
43+
*/
44+
public function getIconHeight()
45+
{
46+
return $this->config->getPayPalIcon()['height'];
47+
}
48+
49+
/**
50+
* @inheritdoc
51+
*/
52+
public function getIconWidth()
53+
{
54+
return $this->config->getPayPalIcon()['width'];
55+
}
56+
57+
/**
58+
* Can render specified token
59+
*
60+
* @param PaymentTokenInterface $token
61+
* @return boolean
62+
*/
63+
public function canRender(PaymentTokenInterface $token)
64+
{
65+
return $token->getPaymentMethodCode() === ConfigProvider::PAYPAL_CODE;
66+
}
67+
68+
/**
69+
* Get email of PayPal payer
70+
* @return string
71+
*/
72+
public function getPayerEmail()
73+
{
74+
return $this->getTokenDetails()['payerEmail'];
75+
}
76+
}

app/code/Magento/Braintree/Gateway/Config/Config.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ class Config extends \Magento\Payment\Gateway\Config\Config
3030
const KEY_KOUNT_MERCHANT_ID = 'kount_id';
3131
const FRAUD_PROTECTION = 'fraudprotection';
3232

33+
/**
34+
* Get list of available dynamic descriptors keys
35+
* @var array
36+
*/
37+
private static $dynamicDescriptorKeys = [
38+
'name', 'phone', 'url'
39+
];
40+
3341
/**
3442
* Return the country specific card type config
3543
*
@@ -169,4 +177,20 @@ public function isActive()
169177
{
170178
return (bool) $this->getValue(self::KEY_ACTIVE);
171179
}
180+
181+
/**
182+
* Get list of configured dynamic descriptors
183+
* @return array
184+
*/
185+
public function getDynamicDescriptors()
186+
{
187+
$values = [];
188+
foreach (self::$dynamicDescriptorKeys as $key) {
189+
$value = $this->getValue('descriptor_' . $key);
190+
if (!empty($value)) {
191+
$values[$key] = $value;
192+
}
193+
}
194+
return $values;
195+
}
172196
}

0 commit comments

Comments
 (0)