File tree Expand file tree Collapse file tree 2 files changed +23
-7
lines changed
app/code/Magento/Customer Expand file tree Collapse file tree 2 files changed +23
-7
lines changed Original file line number Diff line number Diff line change 1
1
<?php
2
+ /**
3
+ * Copyright © Magento, Inc. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
2
6
3
7
namespace Magento \Customer \Observer ;
4
8
@@ -41,10 +45,11 @@ public function execute(Observer $observer)
41
45
$ customerOrig = $ observer ->getEvent ()->getOrigCustomerDataObject ();
42
46
$ emailOrig = $ customerOrig ->getEmail ();
43
47
44
- if ($ email != $ emailOrig ){
45
- $ quote = $ this ->quoteRepository ->getForCustomer ($ customer ->getId ());
46
- $ quote ->setCustomerEmail ($ email );
47
- $ this ->quoteRepository ->save ($ quote );
48
+ if ($ email != $ emailOrig ) {
49
+ $ quote = $ this ->quoteRepository ->getForCustomer ($ customer ->getId ());
50
+ $ quote ->setCustomerEmail ($ email );
51
+ $ this ->quoteRepository ->save ($ quote );
52
+
48
53
}
49
54
}
50
- }
55
+ }
Original file line number Diff line number Diff line change 1
1
<?php
2
+ /**
3
+ * Copyright © Magento, Inc. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
2
6
3
7
namespace Magento \Customer \Test \Unit \Observer ;
4
8
@@ -19,8 +23,14 @@ class UpgradeQuoteCustomerEmailObserverTest extends \PHPUnit\Framework\TestCase
19
23
*/
20
24
protected $ quoteRepositoryMock ;
21
25
26
+ /**
27
+ * @var \Magento\Framework\Event\Observer
28
+ */
22
29
protected $ observerMock ;
23
30
31
+ /**
32
+ * @var \Magento\Framework\Event
33
+ */
24
34
protected $ eventMock ;
25
35
26
36
/**
@@ -46,7 +56,7 @@ protected function setUp()
46
56
}
47
57
48
58
/**
49
- *
59
+ * Unit test for verifying quote customers email upgrade observer
50
60
*/
51
61
public function testUpgradeQuoteCustomerEmail ()
52
62
{
@@ -75,6 +85,7 @@ public function testUpgradeQuoteCustomerEmail()
75
85
$ customer ->expects ($ this ->any ())
76
86
->method ('getEmail ' )
77
87
->willReturn ($ this ->returnValue ($ email ));
88
+
78
89
$ customerOrig ->expects ($ this ->any ())
79
90
->method ('getEmail ' )
80
91
->willReturn ($ this ->returnValue ($ origEmail ));
@@ -92,4 +103,4 @@ public function testUpgradeQuoteCustomerEmail()
92
103
93
104
$ this ->model ->execute ($ this ->observerMock );
94
105
}
95
- }
106
+ }
You can’t perform that action at this time.
0 commit comments