Skip to content

Commit

Permalink
Merge branch 'merchant_beta' of github.corp.magento.com:magento-spart…
Browse files Browse the repository at this point in the history
…a/magento2ce into MDVA-3
  • Loading branch information
Yuriy Denyshchenko committed Nov 27, 2015
2 parents 3f34e03 + 2b9aecb commit f2f39af
Show file tree
Hide file tree
Showing 13 changed files with 706 additions and 388 deletions.
3 changes: 3 additions & 0 deletions app/code/Magento/Bundle/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,7 @@
<argument name="stockState" xsi:type="object">Magento\CatalogInventory\Api\StockStateInterface\Proxy</argument>
</arguments>
</type>
<type name="Magento\Quote\Model\Quote\Item\ToOrderItem">
<plugin name="append_bundle_data_to_order" type="Magento\Bundle\Model\Plugin\QuoteItem"/>
</type>
</config>
19 changes: 13 additions & 6 deletions app/code/Magento/Newsletter/Model/Subscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,11 @@ public function subscribe($email)
$this->setSubscriberConfirmCode($this->randomSequence());
}

$sendConfirmationEmail = true;
if ($this->getStatus() == self::STATUS_SUBSCRIBED && !$this->getCustomerId()) {
$sendConfirmationEmail = false;
}

$isConfirmNeed = $this->_scopeConfig->getValue(
self::XML_PATH_CONFIRMATION_FLAG,
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
Expand Down Expand Up @@ -442,12 +447,14 @@ public function subscribe($email)
$this->setStatusChanged(true);

try {
if ($isConfirmNeed === true
&& $isOwnSubscribes === false
) {
$this->sendConfirmationRequestEmail();
} else {
$this->sendConfirmationSuccessEmail();
if ($sendConfirmationEmail === true) {
if ($isConfirmNeed === true
&& $isOwnSubscribes === false
) {
$this->sendConfirmationRequestEmail();
} else {
$this->sendConfirmationSuccessEmail();
}
}
$this->save();
return $this->getStatus();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public function testGetTransport(

$transport = $this->getMock('\Magento\Framework\Mail\TransportInterface');

$this->_mailTransportFactoryMock->expects(
$this->mailTransportFactoryMock->expects(
$this->at(0)
)->method(
'create'
Expand Down
2 changes: 2 additions & 0 deletions app/code/Magento/User/Model/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ public function sendPasswordResetConfirmationEmail()
{
$templateId = $this->_config->getValue(self::XML_PATH_FORGOT_EMAIL_TEMPLATE);
$transport = $this->_transportBuilder->setTemplateIdentifier($templateId)
->setTemplateNamespace('Magento\Email\Model\BackendTemplate')
->setTemplateOptions(['area' => FrontNameResolver::AREA_CODE, 'store' => Store::DEFAULT_STORE_ID])
->setTemplateVars(['user' => $this, 'store' => $this->_storeManager->getStore(Store::DEFAULT_STORE_ID)])
->setFrom($this->_config->getValue(self::XML_PATH_FORGOT_EMAIL_IDENTITY))
Expand All @@ -388,6 +389,7 @@ public function sendPasswordResetNotificationEmail()
{
$templateId = $this->_config->getValue(self::XML_PATH_RESET_PASSWORD_TEMPLATE);
$transport = $this->_transportBuilder->setTemplateIdentifier($templateId)
->setTemplateNamespace('Magento\Email\Model\BackendTemplate')
->setTemplateOptions(['area' => FrontNameResolver::AREA_CODE, 'store' => Store::DEFAULT_STORE_ID])
->setTemplateVars(['user' => $this, 'store' => $this->_storeManager->getStore(Store::DEFAULT_STORE_ID)])
->setFrom($this->_config->getValue(self::XML_PATH_FORGOT_EMAIL_IDENTITY))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\User\Test\Unit\Model\Plugin;

/**
* Test class for \Magento\User\Model\Plugin\AuthorizationRole testing
*/
class AuthorizationRoleTest extends \PHPUnit_Framework_TestCase
{
/** @var \Magento\User\Model\Plugin\AuthorizationRole */
protected $model;

/** @var \Magento\User\Model\Resource\User|\PHPUnit_Framework_MockObject_MockObject */
protected $userResourceModelMock;

/** @var \Magento\Authorization\Model\Role|\PHPUnit_Framework_MockObject_MockObject */
protected $roleMock;

/**
* Set required values
*/
protected function setUp()
{
$this->userResourceModelMock = $this->getMockBuilder('Magento\User\Model\Resource\User')
->disableOriginalConstructor()
->setMethods([])
->getMock();

$this->roleMock = $this->getMockBuilder('Magento\Authorization\Model\Role')
->disableOriginalConstructor()
->setMethods([])
->getMock();

$objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
$this->model = $objectManager->getObject(
'Magento\User\Model\Plugin\AuthorizationRole',
[
'userResourceModel' => $this->userResourceModelMock
]
);
}

public function testAfterSave()
{
$this->userResourceModelMock->expects($this->once())->method('updateRoleUsersAcl')->with($this->roleMock);
$this->assertInstanceOf(
'\Magento\Authorization\Model\Role',
$this->model->afterSave($this->roleMock, $this->roleMock)
);
}
}
Loading

0 comments on commit f2f39af

Please sign in to comment.