Skip to content

Commit

Permalink
Merge branch 'mainline-develop' into CICD-2012
Browse files Browse the repository at this point in the history
  • Loading branch information
Ann Beeskau committed Dec 14, 2015
2 parents f7fd2ef + 54a6742 commit 4051283
Show file tree
Hide file tree
Showing 43 changed files with 973 additions and 149 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
<block class="Magento\Backend\Block\Widget\Grid\Column" as="package">
<arguments>
<argument name="header" xsi:type="string" translate="true">Design</argument>
<argument name="type" xsi:type="string">options</argument>
<argument name="options" xsi:type="options" model="Magento\Framework\View\Design\Theme\Label\Options"/>
<argument name="width" xsi:type="string">150px</argument>
<argument name="index" xsi:type="string">design</argument>
</arguments>
Expand Down
4 changes: 4 additions & 0 deletions app/code/Magento/Checkout/Model/ConfigProviderInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
*/
namespace Magento\Checkout\Model;

/**
* Interface ConfigProviderInterface
* @api
*/
interface ConfigProviderInterface
{

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ define(
stepNavigator.registerStep(
'payment',
null,
$t('Review & Payments'),
'Review & Payments',
this.isVisible,
_.bind(this.navigate, this),
20
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ define(
stepNavigator.registerStep(
'shipping',
'',
$t('Shipping'),
'Shipping',
this.visible, _.bind(this.navigate, this),
10
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<ul class="opc-progress-bar">
<!-- ko foreach: { data: steps().sort(sortItems), as: 'item' } -->
<li class="opc-progress-bar-item" data-bind="css: item.isVisible() ? '_active' : ($parent.isProcessed(item) ? '_complete' : '')">
<span data-bind="text: item.title, click: $parent.navigateTo"></span>
<span data-bind="i18n: item.title, click: $parent.navigateTo"></span>
</li>
<!-- /ko -->
</ul>
10 changes: 10 additions & 0 deletions app/code/Magento/Cms/Controller/Adminhtml/Block/Save.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
*/
namespace Magento\Cms\Controller\Adminhtml\Block;

use Magento\Cms\Model\Block;

class Save extends \Magento\Cms\Controller\Adminhtml\Block
{
/**
Expand All @@ -21,6 +23,14 @@ public function execute()
$data = $this->getRequest()->getPostValue();
if ($data) {
$id = $this->getRequest()->getParam('block_id');

if (isset($data['is_active']) && $data['is_active'] === 'true') {
$data['is_active'] = Block::STATUS_ENABLED;
}
if (empty($data['block_id'])) {
$data['block_id'] = null;
}

$model = $this->_objectManager->create('Magento\Cms\Model\Block')->load($id);
if (!$model->getId() && $id) {
$this->messageManager->addError(__('This block no longer exists.'));
Expand Down
17 changes: 17 additions & 0 deletions app/code/Magento/Cms/Model/Block.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ class Block extends \Magento\Framework\Model\AbstractModel implements BlockInter
*/
const CACHE_TAG = 'cms_block';

/**#@+
* Block's statuses
*/
const STATUS_ENABLED = 1;
const STATUS_DISABLED = 0;

/**#@-*/
/**
* @var string
*/
Expand Down Expand Up @@ -224,4 +231,14 @@ public function getStores()
{
return $this->hasData('stores') ? $this->getData('stores') : $this->getData('store_id');
}

/**
* Prepare block's statuses.
*
* @return array
*/
public function getAvailableStatuses()
{
return [self::STATUS_ENABLED => __('Enabled'), self::STATUS_DISABLED => __('Disabled')];
}
}
47 changes: 47 additions & 0 deletions app/code/Magento/Cms/Model/Block/Source/IsActive.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Cms\Model\Block\Source;

use Magento\Framework\Data\OptionSourceInterface;

/**
* Class IsActive
*/
class IsActive implements OptionSourceInterface
{
/**
* @var \Magento\Cms\Model\Block
*/
protected $cmsBlock;

/**
* Constructor
*
* @param \Magento\Cms\Model\Block $cmsBlock
*/
public function __construct(\Magento\Cms\Model\Block $cmsBlock)
{
$this->cmsBlock = $cmsBlock;
}

/**
* Get options
*
* @return array
*/
public function toOptionArray()
{
$availableOptions = $this->cmsBlock->getAvailableStatuses();
$options = [];
foreach ($availableOptions as $key => $value) {
$options[] = [
'label' => $value,
'value' => $key,
];
}
return $options;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -160,15 +160,15 @@ public function testSaveAction()
'title' => '"><img src=y onerror=prompt(document.domain)>;',
'identifier' => 'unique_title_123',
'stores' => ['0'],
'is_active' => '1',
'is_active' => true,
'content' => '"><script>alert("cookie: "+document.cookie)</script>'
];

$filteredPostData = [
'title' => '&quot;&gt;&lt;img src=y onerror=prompt(document.domain)&gt;;',
'identifier' => 'unique_title_123',
'stores' => ['0'],
'is_active' => '1',
'is_active' => true,
'content' => '&quot;&gt;&lt;script&gt;alert(&quot;cookie: &quot;+document.cookie)&lt;/script&gt;'
];

Expand Down Expand Up @@ -228,7 +228,7 @@ public function testSaveActionWithoutData()

public function testSaveActionNoId()
{
$this->requestMock->expects($this->any())->method('getPostValue')->willReturn(true);
$this->requestMock->expects($this->any())->method('getPostValue')->willReturn(['block_id' => 1]);
$this->requestMock->expects($this->atLeastOnce())
->method('getParam')
->willReturnMap(
Expand Down Expand Up @@ -261,7 +261,7 @@ public function testSaveActionNoId()

public function testSaveAndContinue()
{
$this->requestMock->expects($this->any())->method('getPostValue')->willReturn(true);
$this->requestMock->expects($this->any())->method('getPostValue')->willReturn(['block_id' => 1]);
$this->requestMock->expects($this->atLeastOnce())
->method('getParam')
->willReturnMap(
Expand Down Expand Up @@ -308,7 +308,7 @@ public function testSaveAndContinue()

public function testSaveActionThrowsException()
{
$this->requestMock->expects($this->any())->method('getPostValue')->willReturn(true);
$this->requestMock->expects($this->any())->method('getPostValue')->willReturn(['block_id' => 1]);
$this->requestMock->expects($this->atLeastOnce())
->method('getParam')
->willReturnMap(
Expand Down Expand Up @@ -345,7 +345,7 @@ public function testSaveActionThrowsException()
$this->messageManagerMock->expects($this->once())
->method('addError');

$this->sessionMock->expects($this->atLeastOnce())->method('setFormData')->with(true);
$this->sessionMock->expects($this->atLeastOnce())->method('setFormData')->with(['block_id' => 1]);

$this->resultRedirect->expects($this->atLeastOnce())
->method('setPath')
Expand Down
83 changes: 83 additions & 0 deletions app/code/Magento/Cms/Test/Unit/Model/Block/Source/IsActiveTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Cms\Test\Unit\Model\Block\Source;

use Magento\Cms\Model\Block;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;

class IsActiveTest extends \PHPUnit_Framework_TestCase
{
/**
* @var Block|\PHPUnit_Framework_MockObject_MockObject
*/
protected $cmsBlockMock;

/**
* @var ObjectManager
*/
protected $objectManagerHelper;

/**
* @var Block\Source\IsActive
*/
protected $object;

/**
* {@inheritdoc}
*/
protected function setUp()
{
$this->objectManagerHelper = new ObjectManager($this);
$this->cmsBlockMock = $this->getMockBuilder('Magento\Cms\Model\Block')
->disableOriginalConstructor()
->setMethods(['getAvailableStatuses'])
->getMock();

$this->object = $this->objectManagerHelper->getObject($this->getSourceClassName(), [
'cmsBlock' => $this->cmsBlockMock,
]);
}

/**
* @return string
*/
protected function getSourceClassName()
{
return 'Magento\Cms\Model\Block\Source\IsActive';
}

/**
* @param array $availableStatuses
* @param array $expected
* @return void
* @dataProvider getAvailableStatusesDataProvider
*/
public function testToOptionArray(array $availableStatuses, array $expected)
{
$this->cmsBlockMock->expects($this->once())
->method('getAvailableStatuses')
->willReturn($availableStatuses);

$this->assertSame($expected, $this->object->toOptionArray());
}

/**
* @return array
*/
public function getAvailableStatusesDataProvider()
{
return [
[
[],
[],
],
[
['testStatus' => 'testValue'],
[['label' => 'testValue', 'value' => 'testStatus']],
],
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -186,16 +186,7 @@
</column>
<column name="is_active">
<argument name="data" xsi:type="array">
<item name="options" xsi:type="array">
<item name="disable" xsi:type="array">
<item name="value" xsi:type="string">0</item>
<item name="label" xsi:type="string" translate="true">Disabled</item>
</item>
<item name="enable" xsi:type="array">
<item name="value" xsi:type="string">1</item>
<item name="label" xsi:type="string" translate="true">Enabled</item>
</item>
</item>
<item name="options" xsi:type="object">Magento\Cms\Model\Block\Source\IsActive</item>
<item name="config" xsi:type="array">
<item name="filter" xsi:type="string">select</item>
<item name="component" xsi:type="string">Magento_Ui/js/grid/columns/select</item>
Expand Down
8 changes: 5 additions & 3 deletions app/code/Magento/Customer/Controller/Account/LoginPost.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ public function execute()
} catch (EmailNotConfirmedException $e) {
$value = $this->customerUrl->getEmailConfirmationUrl($login['username']);
$message = __(
'This account is not confirmed.' .
' <a href="%1">Click here</a> to resend confirmation email.',
'This account is not confirmed. <a href="%1">Click here</a> to resend confirmation email.',
$value
);
$this->messageManager->addError($message);
Expand All @@ -95,7 +94,10 @@ public function execute()
$this->messageManager->addError($message);
$this->session->setUsername($login['username']);
} catch (\Exception $e) {
$this->messageManager->addError(__('Invalid login or password.'));
// PA DSS violation: throwing or logging an exception here can disclose customer password
$this->messageManager->addError(
__('An unspecified error occurred. Please contact us for assistance.')
);
}
} else {
$this->messageManager->addError(__('A login and a password are required.'));
Expand Down
3 changes: 3 additions & 0 deletions app/code/Magento/Customer/Setup/UpgradeData.php
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,9 @@ private function upgradeHash($setup)

$customers = $setup->getConnection()->fetchAll($select);
foreach ($customers as $customer) {
if ($customer['password_hash'] === null) {
continue;
}
list($hash, $salt) = explode(Encryptor::DELIMITER, $customer['password_hash']);

$newHash = $customer['password_hash'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ protected function mockExceptions($exception, $username)
case '\Exception':
$this->messageManager->expects($this->once())
->method('addError')
->with(__('Invalid login or password.'))
->with(__('An unspecified error occurred. Please contact us for assistance.'))
->willReturnSelf();
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,9 @@ define([
/**
* Customer data initialization
*/
init: function () {
if (_.isEmpty(storage.keys())) {
init: function() {
var privateContent = $.cookieStorage.get('private_content_version');
if (_.isEmpty(storage.keys()) && _.isObject(privateContent)) {
this.reload([], false);
} else if (this.needReload()) {
_.each(dataProvider.getFromStorage(storage.keys()), function (sectionData, sectionName) {
Expand Down
13 changes: 13 additions & 0 deletions app/code/Magento/Quote/Setup/UpgradeSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,19 @@ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $con
);
}

if (version_compare($context->getVersion(), '2.0.2', '<')) {
$setup->getConnection()->changeColumn(
$setup->getTable('quote_address'),
'street',
'street',
[
'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
'length' => 255,
'comment' => 'Street'
]
);
}

$setup->endSetup();
}
}
2 changes: 1 addition & 1 deletion app/code/Magento/Quote/etc/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Magento_Quote" setup_version="2.0.1">
<module name="Magento_Quote" setup_version="2.0.2">
</module>
</config>
Loading

0 comments on commit 4051283

Please sign in to comment.