File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed
app/code/Magento/Customer/Model
dev/tests/integration/testsuite/Magento/Customer/Controller Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change 14
14
*
15
15
* @package Magento\Customer\Model
16
16
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
17
+ * @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
17
18
*/
18
19
class Visitor extends \Magento \Framework \Model \AbstractModel
19
20
{
@@ -168,10 +169,6 @@ public function initByRequest($observer)
168
169
169
170
$ this ->setLastVisitAt ((new \DateTime ())->format (\Magento \Framework \Stdlib \DateTime::DATETIME_PHP_FORMAT ));
170
171
171
- // prevent saving Visitor for safe methods, e.g. GET request
172
- if ($ this ->requestSafety ->isSafeMethod ()) {
173
- return $ this ;
174
- }
175
172
if (!$ this ->getId ()) {
176
173
$ this ->setSessionId ($ this ->session ->getSessionId ());
177
174
$ this ->save ();
Original file line number Diff line number Diff line change @@ -751,6 +751,21 @@ public function loginPostRedirectDataProvider()
751
751
];
752
752
}
753
753
754
+ /**
755
+ * @magentoDataFixture Magento/Customer/_files/customer.php
756
+ * @magentoDataFixture Magento/Customer/_files/customer_address.php
757
+ * @magentoAppArea frontend
758
+ */
759
+ public function testCheckVisitorModel ()
760
+ {
761
+ /** @var \Magento\Customer\Model\Visitor $visitor */
762
+ $ visitor = $ this ->_objectManager ->get (\Magento \Customer \Model \Visitor::class);
763
+ $ this ->login (1 );
764
+ $ this ->assertNull ($ visitor ->getId ());
765
+ $ this ->dispatch ('customer/account/index ' );
766
+ $ this ->assertNotNull ($ visitor ->getId ());
767
+ }
768
+
754
769
/**
755
770
* @param string $email
756
771
* @return void
You can’t perform that action at this time.
0 commit comments