diff --git a/app/code/Magento/Customer/Model/CustomerExtractor.php b/app/code/Magento/Customer/Model/CustomerExtractor.php
index bc2880babd4cd..ea842a59b6450 100644
--- a/app/code/Magento/Customer/Model/CustomerExtractor.php
+++ b/app/code/Magento/Customer/Model/CustomerExtractor.php
@@ -65,17 +65,10 @@ public function __construct(
public function extract($formCode, RequestInterface $request)
{
$customerForm = $this->formFactory->create('customer', $formCode);
-
+ $customerData = $customerForm->extractData($request);
$allowedAttributes = $customerForm->getAllowedAttributes();
- $isGroupIdEmpty = true;
- $customerData = [];
- foreach ($allowedAttributes as $attribute) {
- $attributeCode = $attribute->getAttributeCode();
- if ($attributeCode == 'group_id') {
- $isGroupIdEmpty = false;
- }
- $customerData[$attributeCode] = $request->getParam($attributeCode);
- }
+ $isGroupIdEmpty = isset($allowedAttributes['group_id']);
+
$customerDataObject = $this->customerFactory->create();
$this->dataObjectHelper->populateWithArray(
$customerDataObject,
diff --git a/app/code/Magento/Customer/Test/Unit/Model/CustomerExtractorTest.php b/app/code/Magento/Customer/Test/Unit/Model/CustomerExtractorTest.php
new file mode 100644
index 0000000000000..32f3b3040c2f1
--- /dev/null
+++ b/app/code/Magento/Customer/Test/Unit/Model/CustomerExtractorTest.php
@@ -0,0 +1,161 @@
+formFactory = $this->getMockForAbstractClass(
+ 'Magento\Customer\Model\Metadata\FormFactory',
+ [],
+ '',
+ false,
+ false,
+ true,
+ ['create']
+ );
+ $this->customerFactory = $this->getMockForAbstractClass(
+ 'Magento\Customer\Api\Data\CustomerInterfaceFactory',
+ [],
+ '',
+ false,
+ false,
+ true,
+ ['create']
+ );
+ $this->storeManager = $this->getMockForAbstractClass(
+ 'Magento\Store\Model\StoreManagerInterface',
+ [],
+ '',
+ false
+ );
+ $this->customerGroupManagement = $this->getMockForAbstractClass(
+ 'Magento\Customer\Api\GroupManagementInterface',
+ [],
+ '',
+ false
+ );
+ $this->dataObjectHelper = $this->getMock('Magento\Framework\Api\DataObjectHelper', [], [], '', false);
+ $this->request = $this->getMockForAbstractClass('Magento\Framework\App\RequestInterface', [], '', false);
+ $this->customerForm = $this->getMock('Magento\Customer\Model\Metadata\Form', [], [], '', false);
+ $this->customerData = $this->getMockForAbstractClass(
+ 'Magento\Customer\Api\Data\CustomerInterface',
+ [],
+ '',
+ false
+ );
+ $this->store = $this->getMockForAbstractClass(
+ 'Magento\Store\Api\Data\StoreInterface',
+ [],
+ '',
+ false
+ );
+ $this->customerGroup = $this->getMockForAbstractClass(
+ 'Magento\Customer\Api\Data\GroupInterface',
+ [],
+ '',
+ false
+ );
+ $this->customerExtractor = new CustomerExtractor(
+ $this->formFactory,
+ $this->customerFactory,
+ $this->storeManager,
+ $this->customerGroupManagement,
+ $this->dataObjectHelper
+ );
+ }
+
+ public function testExtract()
+ {
+ $customerData = [
+ 'firstname' => 'firstname',
+ 'lastname' => 'firstname',
+ 'email' => 'email.example.com',
+ ];
+
+ $this->formFactory->expects($this->once())
+ ->method('create')
+ ->with('customer', 'form-code')
+ ->willReturn($this->customerForm);
+ $this->customerForm->expects($this->once())
+ ->method('extractData')
+ ->with($this->request)
+ ->willReturn($customerData);
+ $this->customerForm->expects($this->once())
+ ->method('getAllowedAttributes')
+ ->willReturn(['group_id' => 'attribute object']);
+ $this->customerFactory->expects($this->once())
+ ->method('create')
+ ->willReturn($this->customerData);
+ $this->dataObjectHelper->expects($this->once())
+ ->method('populateWithArray')
+ ->with($this->customerData, $customerData, '\Magento\Customer\Api\Data\CustomerInterface')
+ ->willReturn($this->customerData);
+ $this->storeManager->expects($this->once())
+ ->method('getStore')
+ ->willReturn($this->store);
+ $this->store->expects($this->exactly(2))
+ ->method('getId')
+ ->willReturn(1);
+ $this->customerGroupManagement->expects($this->once())
+ ->method('getDefaultGroup')
+ ->with(1)
+ ->willReturn($this->customerGroup);
+ $this->customerGroup->expects($this->once())
+ ->method('getId')
+ ->willReturn(1);
+ $this->customerData->expects($this->once())
+ ->method('setGroupId')
+ ->with(1);
+ $this->store->expects($this->once())
+ ->method('getWebsiteId')
+ ->willReturn(1);
+ $this->customerData->expects($this->once())
+ ->method('setWebsiteId')
+ ->with(1);
+ $this->customerData->expects($this->once())
+ ->method('setStoreId')
+ ->with(1);
+
+ $this->assertSame($this->customerData, $this->customerExtractor->extract('form-code', $this->request));
+ }
+}
diff --git a/app/code/Magento/Customer/view/adminhtml/ui_component/customer_online_grid.xml b/app/code/Magento/Customer/view/adminhtml/ui_component/customer_online_grid.xml
index 282ef7c53d077..2daf52c1cb267 100644
--- a/app/code/Magento/Customer/view/adminhtml/ui_component/customer_online_grid.xml
+++ b/app/code/Magento/Customer/view/adminhtml/ui_component/customer_online_grid.xml
@@ -135,23 +135,6 @@
-
-
-
- -
-
- dateRange
- - date
- - Magento_Ui/js/grid/columns/date
- - Session Start Time
-
-
-
-
@@ -173,12 +156,5 @@
-
diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Totals.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Totals.php
index cf5d44bb2458d..3fa2f00291fc5 100644
--- a/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Totals.php
+++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Create/Totals.php
@@ -83,7 +83,14 @@ protected function _construct()
*/
public function getTotals()
{
- return $this->getQuote()->getTotals();
+ $this->getQuote()->setTotalsCollectedFlag(false);
+ $this->getQuote()->collectTotals();
+ if ($this->getQuote()->isVirtual()) {
+ $totals = $this->getQuote()->getBillingAddress()->getTotals();
+ } else {
+ $totals = $this->getQuote()->getShippingAddress()->getTotals();
+ }
+ return $totals;
}
/**
diff --git a/app/code/Magento/Sales/Test/Unit/Block/Order/Create/TotalsTest.php b/app/code/Magento/Sales/Test/Unit/Block/Order/Create/TotalsTest.php
new file mode 100644
index 0000000000000..9132bacd0eb2c
--- /dev/null
+++ b/app/code/Magento/Sales/Test/Unit/Block/Order/Create/TotalsTest.php
@@ -0,0 +1,111 @@
+helperManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
+ $this->sessionQuoteMock = $this->getMockBuilder('Magento\Backend\Model\Session\Quote')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->quoteMock = $this->getMockBuilder('Magento\Quote\Model\Quote')
+ ->disableOriginalConstructor()
+ ->setMethods([
+ 'setTotalsCollectedFlag',
+ 'collectTotals',
+ 'getTotals',
+ 'isVirtual',
+ 'getBillingAddress',
+ 'getShippingAddress'
+ ])
+ ->getMock();
+ $this->shippingAddressMock = $this->getMockBuilder('Magento\Quote\Model\Quote\Address')
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->billingAddressMock = $this->getMockBuilder('Magento\Quote\Model\Quote\Address')
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $this->quoteMock->expects($this->any())
+ ->method('getBillingAddress')
+ ->willreturn($this->billingAddressMock);
+ $this->quoteMock->expects($this->any())
+ ->method('getShippingAddress')
+ ->willreturn($this->shippingAddressMock);
+ $this->sessionQuoteMock->expects($this->any())->method('getQuote')->willReturn($this->quoteMock);
+ $this->totals = $this->helperManager->getObject(
+ 'Magento\Sales\Block\Adminhtml\Order\Create\Totals',
+ ['sessionQuote' => $this->sessionQuoteMock]
+ );
+ }
+
+ /**
+ * @dataProvider totalsDataProvider
+ */
+ public function testGetTotals($isVirtual)
+ {
+ $expected = 'expected';
+ $this->quoteMock->expects($this->at(0))->method('setTotalsCollectedFlag')->with(false);
+ $this->quoteMock->expects($this->at(1))->method('collectTotals');
+ $this->quoteMock->expects($this->once())->method('isVirtual')->willreturn($isVirtual);
+ if ($isVirtual) {
+ $this->billingAddressMock->expects($this->once())->method('getTotals')->willReturn($expected);
+ } else {
+ $this->shippingAddressMock->expects($this->once())->method('getTotals')->willReturn($expected);
+ }
+ $this->assertEquals($expected, $this->totals->getTotals());
+ }
+
+ /**
+ * @return array
+ */
+ public function totalsDataProvider()
+ {
+ return [
+ [true],
+ [false]
+ ];
+ }
+}
diff --git a/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php b/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php
index abe4b4303603f..8305dabca481c 100644
--- a/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php
+++ b/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php
@@ -3628,7 +3628,7 @@ protected function _prepareSqlDateCondition($condition, $key)
$result = $this->formatDate($condition[$key]);
}
} else {
- $result = $this->formatDate($condition[$key]);
+ $result = $this->formatDate($condition[$key], false);
}
return $result;
diff --git a/lib/internal/Magento/Framework/Stdlib/Cookie/PhpCookieManager.php b/lib/internal/Magento/Framework/Stdlib/Cookie/PhpCookieManager.php
index 611683a912530..6e23952d787f5 100644
--- a/lib/internal/Magento/Framework/Stdlib/Cookie/PhpCookieManager.php
+++ b/lib/internal/Magento/Framework/Stdlib/Cookie/PhpCookieManager.php
@@ -16,15 +16,17 @@
* To aid in security, the cookie manager will make it possible for the application to indicate if the cookie contains
* sensitive data so that extra protection can be added to the contents of the cookie as well as how the browser
* stores the cookie.
+ *
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class PhpCookieManager implements CookieManagerInterface
{
/**#@+
* Constants for Cookie manager.
* RFC 2109 - Page 15
- * http://www.ietf.org/rfc/rfc2109.txt
+ * http://www.ietf.org/rfc/rfc6265.txt
*/
- const MAX_NUM_COOKIES = 20;
+ const MAX_NUM_COOKIES = 50;
const MAX_COOKIE_SIZE = 4096;
const EXPIRE_NOW_TIME = 1;
const EXPIRE_AT_END_OF_SESSION_TIME = 0;
diff --git a/lib/internal/Magento/Framework/Stdlib/Test/Unit/Cookie/PhpCookieManagerTest.php b/lib/internal/Magento/Framework/Stdlib/Test/Unit/Cookie/PhpCookieManagerTest.php
index cd969c1e2efbf..34e3c855ecf98 100644
--- a/lib/internal/Magento/Framework/Stdlib/Test/Unit/Cookie/PhpCookieManagerTest.php
+++ b/lib/internal/Magento/Framework/Stdlib/Test/Unit/Cookie/PhpCookieManagerTest.php
@@ -43,7 +43,7 @@ class PhpCookieManagerTest extends \PHPUnit_Framework_TestCase
const COOKIE_HTTP_ONLY = true;
const COOKIE_NOT_HTTP_ONLY = false;
const COOKIE_EXPIRE_END_OF_SESSION = 0;
- const MAX_NUM_COOKIES = 20;
+ const MAX_NUM_COOKIES = 50;
const MAX_COOKIE_SIZE = 4096;
/**