Skip to content

Commit 766db37

Browse files
committed
Add Copyright to UpgradeQuoteCustomerEmailObserver and Test
1 parent 7ef77d7 commit 766db37

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed

app/code/Magento/Customer/Observer/UpgradeQuoteCustomerEmailObserver.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
26

37
namespace Magento\Customer\Observer;
48

@@ -41,10 +45,11 @@ public function execute(Observer $observer)
4145
$customerOrig = $observer->getEvent()->getOrigCustomerDataObject();
4246
$emailOrig = $customerOrig->getEmail();
4347

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+
4853
}
4954
}
50-
}
55+
}

app/code/Magento/Customer/Test/Unit/Observer/UpgradeQuoteCustomerEmailObserverTest.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
26

37
namespace Magento\Customer\Test\Unit\Observer;
48

@@ -19,8 +23,14 @@ class UpgradeQuoteCustomerEmailObserverTest extends \PHPUnit\Framework\TestCase
1923
*/
2024
protected $quoteRepositoryMock;
2125

26+
/**
27+
* @var \Magento\Framework\Event\Observer
28+
*/
2229
protected $observerMock;
2330

31+
/**
32+
* @var \Magento\Framework\Event
33+
*/
2434
protected $eventMock;
2535

2636
/**
@@ -46,7 +56,7 @@ protected function setUp()
4656
}
4757

4858
/**
49-
*
59+
* Unit test for verifying quote customers email upgrade observer
5060
*/
5161
public function testUpgradeQuoteCustomerEmail()
5262
{
@@ -75,6 +85,7 @@ public function testUpgradeQuoteCustomerEmail()
7585
$customer->expects($this->any())
7686
->method('getEmail')
7787
->willReturn($this->returnValue($email));
88+
7889
$customerOrig->expects($this->any())
7990
->method('getEmail')
8091
->willReturn($this->returnValue($origEmail));
@@ -92,4 +103,4 @@ public function testUpgradeQuoteCustomerEmail()
92103

93104
$this->model->execute($this->observerMock);
94105
}
95-
}
106+
}

0 commit comments

Comments
 (0)