10
10
use Magento \Config \Model \Config \PathValidator ;
11
11
use Magento \Config \Model \Config \Structure ;
12
12
use Magento \Config \Model \Config \Structure \Element \Field ;
13
+ use Magento \Framework \DataObject ;
13
14
use Magento \Framework \Exception \ValidatorException ;
14
- use Magento \Theme \Api \Data \DesignConfigExtensionInterface ;
15
15
use Magento \Theme \Api \Data \DesignConfigInterface ;
16
16
use Magento \Theme \Model \DesignConfigRepository ;
17
17
use Magento \Theme \Plugin \DesignPathValidatorPlugin ;
@@ -57,32 +57,27 @@ public function testAroundValidateWithValidPath()
57
57
$ path = 'design/header/default_title ' ;
58
58
59
59
$ field = $ this ->createMock (Field::class);
60
+ $ designConfig = $ this ->createMock (DesignConfigInterface::class);
61
+ $ extensionAttributes = $ this ->createMock (DataObject::class);
62
+
60
63
$ field ->expects ($ this ->exactly (2 ))
61
64
->method ('getConfigPath ' )
62
65
->willReturn ($ path );
63
-
64
66
$ this ->structure ->expects ($ this ->once ())
65
67
->method ('getElementByConfigPath ' )
66
68
->with ($ path )
67
69
->willReturn ($ field );
68
70
$ this ->structure ->expects ($ this ->once ())
69
71
->method ('getFieldPaths ' )
70
72
->willReturn ([$ path => $ path ]);
71
-
72
- $ designConfig = $ this ->createMock (DesignConfigInterface::class);
73
- $ extensionAttributes = $ this ->createConfiguredStub (
74
- DesignConfigExtensionInterface::class,
75
- [
76
- 'getDesignConfigData ' => []
77
- ]
78
- );
79
73
$ designConfig ->expects ($ this ->once ())
80
74
->method ('getExtensionAttributes ' )
81
75
->willReturn ($ extensionAttributes );
82
76
$ extensionAttributes ->expects ($ this ->once ())
83
- ->method ('getDesignConfigData ' )
84
- ->willReturn ([]);
85
-
77
+ ->method ('__call ' )
78
+ ->with (
79
+ $ this ->equalTo ('getDesignConfigData ' )
80
+ )->willReturn ([]);
86
81
$ this ->designConfigRepository ->expects ($ this ->once ())
87
82
->method ('getByScope ' )
88
83
->with ('default ' , null )
@@ -102,6 +97,9 @@ public function testAroundValidateWithInvalidPath()
102
97
$ this ->expectException (ValidatorException::class);
103
98
104
99
$ pathValidator = $ this ->createMock (PathValidator::class);
100
+ $ designConfig = $ this ->createMock (DesignConfigInterface::class);
101
+ $ extensionAttributes = $ this ->createMock (DataObject::class);
102
+
105
103
$ proceed = function ($ path ) {
106
104
return true ;
107
105
};
@@ -114,21 +112,14 @@ public function testAroundValidateWithInvalidPath()
114
112
$ this ->structure ->expects ($ this ->once ())
115
113
->method ('getFieldPaths ' )
116
114
->willReturn ([]);
117
-
118
- $ designConfig = $ this ->createMock (DesignConfigInterface::class);
119
- $ extensionAttributes = $ this ->createConfiguredStub (
120
- DesignConfigExtensionInterface::class,
121
- [
122
- 'getDesignConfigData ' => []
123
- ]
124
- );
125
115
$ designConfig ->expects ($ this ->once ())
126
116
->method ('getExtensionAttributes ' )
127
117
->willReturn ($ extensionAttributes );
128
118
$ extensionAttributes ->expects ($ this ->once ())
129
- ->method ('getDesignConfigData ' )
130
- ->willReturn ([]);
131
-
119
+ ->method ('__call ' )
120
+ ->with (
121
+ $ this ->equalTo ('getDesignConfigData ' )
122
+ )->willReturn ([]);
132
123
$ this ->designConfigRepository ->expects ($ this ->once ())
133
124
->method ('getByScope ' )
134
125
->with ('default ' , null )
0 commit comments