File tree Expand file tree Collapse file tree 3 files changed +14
-34
lines changed
app/code/Magento/Customer
dev/tests/integration/testsuite/Magento/Customer/Model Expand file tree Collapse file tree 3 files changed +14
-34
lines changed Original file line number Diff line number Diff line change 11<?php
22/**
3- * Copyright © Magento, Inc. All rights reserved.
4- * See COPYING.txt for license details .
3+ * Copyright 2014 Adobe
4+ * All Rights Reserved .
55 */
66declare (strict_types=1 );
77
3535 */
3636class Visitor extends AbstractModel
3737{
38- const VISITOR_TYPE_CUSTOMER = 'c ' ;
39- const VISITOR_TYPE_VISITOR = 'v ' ;
40- const DEFAULT_ONLINE_MINUTES_INTERVAL = 15 ;
41- const XML_PATH_ONLINE_INTERVAL = 'customer/online_customers/online_minutes_interval ' ;
38+ public const VISITOR_TYPE_CUSTOMER = 'c ' ;
39+ public const VISITOR_TYPE_VISITOR = 'v ' ;
40+ public const DEFAULT_ONLINE_MINUTES_INTERVAL = 15 ;
41+ public const XML_PATH_ONLINE_INTERVAL = 'customer/online_customers/online_minutes_interval ' ;
4242 private const SECONDS_24_HOURS = 86400 ;
4343
4444 /**
@@ -213,7 +213,6 @@ public function afterSave()
213213 return parent ::afterSave ();
214214 }
215215
216-
217216 /**
218217 * Save visitor by request
219218 *
@@ -293,6 +292,7 @@ public function bindCustomerLogin($observer)
293292 if (!$ this ->getCustomerId ()) {
294293 $ this ->setDoCustomerLogin (true );
295294 $ this ->setCustomerId ($ customer ->getId ());
295+ $ this ->setCreatedAt ((new \DateTime ())->format (DateTime::DATETIME_PHP_FORMAT ));
296296 }
297297 return $ this ;
298298 }
Original file line number Diff line number Diff line change 11<?php
22/**
3- * Copyright © Magento, Inc. All rights reserved.
4- * See COPYING.txt for license details .
3+ * Copyright 2015 Adobe
4+ * All Rights Reserved .
55 */
66
77namespace Magento \Customer \Observer \Visitor ;
88
9- use Magento \Customer \Model \Visitor ;
109use Magento \Framework \Event \Observer ;
11- use Magento \Framework \Session \SessionManagerInterface ;
1210
1311/**
1412 * Visitor Observer
15- * @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
1613 */
1714class InitByRequestObserver extends AbstractVisitorObserver
1815{
19- /**
20- * @var SessionManagerInterface
21- */
22- private $ sessionManager ;
23-
24- /**
25- * @param Visitor $visitor
26- * @param SessionManagerInterface $sessionManager
27- */
28- public function __construct (
29- Visitor $ visitor ,
30- SessionManagerInterface $ sessionManager
31- ) {
32- parent ::__construct ($ visitor );
33- $ this ->sessionManager = $ sessionManager ;
34- }
35-
3616 /**
3717 * Init visitor by request
3818 *
@@ -41,9 +21,6 @@ public function __construct(
4121 */
4222 public function execute (Observer $ observer )
4323 {
44- if ($ observer ->getRequest ()->getFullActionName () === 'customer_account_loginPost ' ) {
45- $ this ->sessionManager ->setVisitorData (['do_customer_login ' => true ]);
46- }
4724 $ this ->visitor ->initByRequest ($ observer );
4825 }
4926}
Original file line number Diff line number Diff line change 11<?php
22/**
3- * Copyright © Magento, Inc. All rights reserved.
4- * See COPYING.txt for license details .
3+ * Copyright 2014 Adobe
4+ * All Rights Reserved .
55 */
66namespace Magento \Customer \Model ;
77
@@ -25,11 +25,14 @@ public function testBindCustomerLogin()
2525 // Visitor has not customer ID yet
2626 $ this ->assertTrue ($ visitor ->getDoCustomerLogin ());
2727 $ this ->assertEquals ($ customer ->getId (), $ visitor ->getCustomerId ());
28+ $ this ->assertNotNull ($ visitor ->getCreatedAt ());
2829
2930 // Visitor already has customer ID
31+ $ createdAt = $ visitor ->getCreatedAt ();
3032 $ visitor ->unsDoCustomerLogin ();
3133 $ this ->_loginCustomer ('customer@example.com ' , 'password ' );
3234 $ this ->assertNull ($ visitor ->getDoCustomerLogin ());
35+ $ this ->assertEquals ($ createdAt , $ visitor ->getCreatedAt ());
3336 }
3437
3538 /**
You can’t perform that action at this time.
0 commit comments