Skip to content

Commit 6287e1b

Browse files
committed
ACP2E-3324: fix unit test current and future deprecations
1 parent 3af149b commit 6287e1b

File tree

1 file changed

+15
-24
lines changed

1 file changed

+15
-24
lines changed

app/code/Magento/Theme/Test/Unit/Plugin/DesignPathValidatorPluginTest.php

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
use Magento\Config\Model\Config\PathValidator;
1111
use Magento\Config\Model\Config\Structure;
1212
use Magento\Config\Model\Config\Structure\Element\Field;
13+
use Magento\Framework\DataObject;
1314
use Magento\Framework\Exception\ValidatorException;
14-
use Magento\Theme\Api\Data\DesignConfigExtensionInterface;
1515
use Magento\Theme\Api\Data\DesignConfigInterface;
1616
use Magento\Theme\Model\DesignConfigRepository;
1717
use Magento\Theme\Plugin\DesignPathValidatorPlugin;
@@ -57,32 +57,27 @@ public function testAroundValidateWithValidPath()
5757
$path = 'design/header/default_title';
5858

5959
$field = $this->createMock(Field::class);
60+
$designConfig = $this->createMock(DesignConfigInterface::class);
61+
$extensionAttributes = $this->createMock(DataObject::class);
62+
6063
$field->expects($this->exactly(2))
6164
->method('getConfigPath')
6265
->willReturn($path);
63-
6466
$this->structure->expects($this->once())
6567
->method('getElementByConfigPath')
6668
->with($path)
6769
->willReturn($field);
6870
$this->structure->expects($this->once())
6971
->method('getFieldPaths')
7072
->willReturn([$path => $path]);
71-
72-
$designConfig = $this->createMock(DesignConfigInterface::class);
73-
$extensionAttributes = $this->createConfiguredStub(
74-
DesignConfigExtensionInterface::class,
75-
[
76-
'getDesignConfigData' => []
77-
]
78-
);
7973
$designConfig->expects($this->once())
8074
->method('getExtensionAttributes')
8175
->willReturn($extensionAttributes);
8276
$extensionAttributes->expects($this->once())
83-
->method('getDesignConfigData')
84-
->willReturn([]);
85-
77+
->method('__call')
78+
->with(
79+
$this->equalTo('getDesignConfigData')
80+
)->willReturn([]);
8681
$this->designConfigRepository->expects($this->once())
8782
->method('getByScope')
8883
->with('default', null)
@@ -102,6 +97,9 @@ public function testAroundValidateWithInvalidPath()
10297
$this->expectException(ValidatorException::class);
10398

10499
$pathValidator = $this->createMock(PathValidator::class);
100+
$designConfig = $this->createMock(DesignConfigInterface::class);
101+
$extensionAttributes = $this->createMock(DataObject::class);
102+
105103
$proceed = function ($path) {
106104
return true;
107105
};
@@ -114,21 +112,14 @@ public function testAroundValidateWithInvalidPath()
114112
$this->structure->expects($this->once())
115113
->method('getFieldPaths')
116114
->willReturn([]);
117-
118-
$designConfig = $this->createMock(DesignConfigInterface::class);
119-
$extensionAttributes = $this->createConfiguredStub(
120-
DesignConfigExtensionInterface::class,
121-
[
122-
'getDesignConfigData' => []
123-
]
124-
);
125115
$designConfig->expects($this->once())
126116
->method('getExtensionAttributes')
127117
->willReturn($extensionAttributes);
128118
$extensionAttributes->expects($this->once())
129-
->method('getDesignConfigData')
130-
->willReturn([]);
131-
119+
->method('__call')
120+
->with(
121+
$this->equalTo('getDesignConfigData')
122+
)->willReturn([]);
132123
$this->designConfigRepository->expects($this->once())
133124
->method('getByScope')
134125
->with('default', null)

0 commit comments

Comments
 (0)