Skip to content

Commit a3179fd

Browse files
committed
ACP2E-3361: Some of the relations records are saved to DB when order record is saved
1 parent 24f519e commit a3179fd

File tree

1 file changed

+26
-15
lines changed

1 file changed

+26
-15
lines changed

app/code/Magento/Customer/Test/Unit/Model/ResourceModel/Db/VersionControl/AddressSnapshotTest.php

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99

1010
use Magento\Customer\Model\ResourceModel\Db\VersionControl\AddressSnapshot;
1111
use Magento\Framework\DataObject;
12+
use Magento\Framework\Exception\LocalizedException;
1213
use Magento\Framework\Model\ResourceModel\Db\VersionControl\Metadata;
14+
use Magento\Framework\Serialize\SerializerInterface;
1315
use PHPUnit\Framework\MockObject\MockObject;
1416
use PHPUnit\Framework\TestCase;
1517

@@ -18,22 +20,30 @@ class AddressSnapshotTest extends TestCase
1820
/**
1921
* @var AddressSnapshot
2022
*/
21-
private $model;
23+
private AddressSnapshot $model;
2224

2325
/**
2426
* @var Metadata|MockObject
2527
*/
26-
private $metadataMock;
28+
private Metadata $metadataMock;
2729

30+
/**
31+
* @var SerializerInterface|MockObject
32+
*/
33+
private SerializerInterface $serializer;
34+
35+
/**
36+
* @return void
37+
* @throws \PHPUnit\Framework\MockObject\Exception
38+
*/
2839
protected function setUp(): void
2940
{
30-
$this->metadataMock = $this->getMockBuilder(
31-
Metadata::class
32-
)->disableOriginalConstructor()
33-
->getMock();
41+
$this->metadataMock = $this->createMock(Metadata::class);
42+
$this->serializer = $this->createMock(SerializerInterface::class);
3443

3544
$this->model = new AddressSnapshot(
36-
$this->metadataMock
45+
$this->metadataMock,
46+
$this->serializer
3747
);
3848
}
3949

@@ -43,13 +53,10 @@ protected function setUp(): void
4353
* @param int $isDefaultShipping
4454
* @param bool $expected
4555
* @dataProvider dataProviderIsModified
56+
* @throws LocalizedException
4657
*/
47-
public function testIsModified(
48-
$isCustomerSaveTransaction,
49-
$isDefaultBilling,
50-
$isDefaultShipping,
51-
$expected
52-
) {
58+
public function testIsModified($isCustomerSaveTransaction, $isDefaultBilling, $isDefaultShipping, $expected): void
59+
{
5360
$entityId = 1;
5461

5562
$dataObjectMock = $this->getMockBuilder(DataObject::class)
@@ -96,7 +103,7 @@ public function testIsModified(
96103
/**
97104
* @return array
98105
*/
99-
public static function dataProviderIsModified()
106+
public static function dataProviderIsModified(): array
100107
{
101108
return [
102109
[false, 1, 1, true],
@@ -106,7 +113,11 @@ public static function dataProviderIsModified()
106113
];
107114
}
108115

109-
public function testIsModifiedBypass()
116+
/**
117+
* @return void
118+
* @throws LocalizedException
119+
*/
120+
public function testIsModifiedBypass(): void
110121
{
111122
$dataObjectMock = $this->getMockBuilder(DataObject::class)
112123
->disableOriginalConstructor()

0 commit comments

Comments
 (0)