Skip to content

Commit

Permalink
🔃 [EngCom] Public Pull Requests - 2.1-develop
Browse files Browse the repository at this point in the history
Accepted Public Pull Requests:
 - magento#16403: [Backport 2.1] Captcha: Added integration tests for checking customer login attempts cleanup (by @rogyar)
 - magento#16352: [Backport] Invoice grid shows wrong shipping & handling for partial items invoice. It shows order's shipping & handling instead if invoiced shipping& handling charge (by @gelanivishal)
 - magento#16280: MAGETWO-61209: Backport - Fixed issue magento#7379 with mage/calendar when setting `numberOfM� (by @vasilii-b)


Fixed GitHub Issues:
 - magento#7379: Calendar widget (jQuery UI DatePicker) with numberOfMonths = 2 or more (reported by @atihomirov) has been fixed in magento#16280 by @vasilii-b in 2.1-develop branch
   Related commits:
     1. ce38bc8
  • Loading branch information
Stanislav Idolov authored Jun 29, 2018
2 parents 65cceab + b9fc7e2 commit 1de3379
Show file tree
Hide file tree
Showing 6 changed files with 149 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/code/Magento/Sales/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -669,8 +669,8 @@
<item name="billing_address" xsi:type="object">BillingAddressAggregator</item>
<item name="shipping_address" xsi:type="object">ShippingAddressAggregator</item>
<item name="shipping_information" xsi:type="string">sales_order.shipping_description</item>
<item name="subtotal" xsi:type="string">sales_order.base_subtotal</item>
<item name="shipping_and_handling" xsi:type="string">sales_order.base_shipping_amount</item>
<item name="subtotal" xsi:type="string">sales_invoice.base_subtotal</item>
<item name="shipping_and_handling" xsi:type="string">sales_invoice.base_shipping_amount</item>
<item name="base_grand_total" xsi:type="string">sales_invoice.base_grand_total</item>
<item name="grand_total" xsi:type="string">sales_invoice.grand_total</item>
<item name="created_at" xsi:type="string">sales_invoice.created_at</item>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Captcha\Observer;

use Magento\Captcha\Model\ResourceModel\Log as CaptchaLog;
use Magento\Captcha\Model\ResourceModel\LogFactory;
use Magento\Framework\Event\ManagerInterface;
use Magento\Framework\ObjectManagerInterface;

/**
* Class ResetAttemptForFrontendAccountEditObserverTest
*
* Test for checking that the customer login attempts are removed after account details edit
*/
class ResetAttemptForFrontendAccountEditObserverTest extends \PHPUnit_Framework_TestCase
{
/**
* @var ObjectManagerInterface
*/
private $objectManager;

public function setUp()
{
$this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
}

/**
* @magentoDataFixture Magento/Captcha/_files/failed_logins_frontend.php
*/
public function testAccountEditRemovesFailedAttempts()
{
$customerEmail = 'mageuser@dummy.com';
$captchaLogFactory = $this->objectManager->get(LogFactory::class);
$eventManager = $this->objectManager->get(ManagerInterface::class);

$eventManager->dispatch(
'customer_account_edited',
['email' => $customerEmail]
);

/**
* @var CaptchaLog $captchaLog
*/
$captchaLog = $captchaLogFactory->create();

self::assertEquals(0, $captchaLog->countAttemptsByUserLogin($customerEmail));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Captcha\Observer;

use Magento\Captcha\Model\ResourceModel\Log as CaptchaLog;
use Magento\Captcha\Model\ResourceModel\LogFactory;
use Magento\Customer\Model\Customer;
use Magento\Customer\Model\CustomerFactory;
use Magento\Framework\Event\ManagerInterface;
use Magento\Framework\ObjectManagerInterface;

/**
* Class ResetAttemptForFrontendObserverTest
*
* Test for checking that the customer login attempts are removed after a successful login
*/
class ResetAttemptForFrontendObserverTest extends \PHPUnit_Framework_TestCase
{
/**
* @var ObjectManagerInterface
*/
private $objectManager;

public function setUp()
{
$this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
}

/**
* @magentoDataFixture Magento/Captcha/_files/failed_logins_frontend.php
*/
public function testSuccesfulLoginRemovesFailedAttempts()
{
$customerEmail = 'mageuser@dummy.com';
$customerFactory = $this->objectManager->get(CustomerFactory::class);
$captchaLogFactory = $this->objectManager->get(LogFactory::class);
$eventManager = $this->objectManager->get(ManagerInterface::class);

/** @var Customer $customer */
$customer = $customerFactory->create();
$customer->setEmail($customerEmail);

$eventManager->dispatch(
'customer_customer_authenticated',
['model' => $customer, 'password' => 'some_password']
);

/**
* @var CaptchaLog $captchaLog
*/
$captchaLog = $captchaLogFactory->create();

self::assertEquals(0, $captchaLog->countAttemptsByUserLogin($customerEmail));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

use Magento\TestFramework\Helper\Bootstrap;
use Magento\Captcha\Model\ResourceModel\LogFactory;
use Magento\Captcha\Model\ResourceModel\Log;

$objectManager = Bootstrap::getObjectManager();
$logFactory = $objectManager->get(LogFactory::class);

/** @var Log $captchaLog */
$captchaLog = $logFactory->create();
$captchaLog->logAttempt('mageuser@dummy.com');
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

use Magento\TestFramework\Helper\Bootstrap;
use Magento\Captcha\Model\ResourceModel\LogFactory;
use Magento\Captcha\Model\ResourceModel\Log;

$objectManager = Bootstrap::getObjectManager();
$logFactory = $objectManager->get(LogFactory::class);

/** @var Log $captchaLog */
$captchaLog = $logFactory->create();
$captchaLog->deleteUserAttempts('mageuser@dummy.com');
10 changes: 6 additions & 4 deletions lib/web/mage/calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,12 +238,14 @@
firstDay = parseInt(this._get(inst, 'firstDay'), 10);
firstDay = isNaN(firstDay) ? 0 : firstDay;

for (row; row < numMonths[0]; row++) {
for (row = 0; row < numMonths[0]; row++) {
this.maxRows = 4;

for (col; col < numMonths[1]; col++) {
for (col = 0; col < numMonths[1]; col++) {
selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay));

calender = '';

if (isMultiMonth) {
calender += '<div class="ui-datepicker-group';

Expand Down Expand Up @@ -273,7 +275,7 @@
thead = showWeek ?
'<th class="ui-datepicker-week-col">' + this._get(inst, 'weekHeader') + '</th>' : '';

for (dow; dow < 7; dow++) { // days of the week
for (dow = 0; dow < 7; dow++) { // days of the week
day = (dow + firstDay) % 7;
thead += '<th' + ((dow + firstDay + 6) % 7 >= 5 ?
' class="ui-datepicker-week-end"' : '') + '>' +
Expand All @@ -291,7 +293,7 @@
this.maxRows = numRows;
printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays));

for (dRow; dRow < numRows; dRow++) { // create date picker rows
for (dRow = 0; dRow < numRows; dRow++) { // create date picker rows
calender += '<tr>';
tbody = !showWeek ? '' : '<td class="ui-datepicker-week-col">' +
this._get(inst, 'calculateWeek')(printDate) + '</td>';
Expand Down

0 comments on commit 1de3379

Please sign in to comment.