@@ -51,8 +51,8 @@ protected function setUp()
51
51
->disableOriginalConstructor ()
52
52
->getMock ();
53
53
$ errorMock = $ this ->getMockBuilder (Error::class)->disableOriginalConstructor ()->getMock ();
54
- $ errorMock ->expects ( $ this -> any ())-> method ('getErrorMessage ' )->willReturn ('error message ' );
55
- $ this ->errorFactory ->expects ( $ this -> any ())-> method ('create ' )->willReturn ($ errorMock );
54
+ $ errorMock ->method ('getErrorMessage ' )->willReturn ('error message ' );
55
+ $ this ->errorFactory ->method ('create ' )->willReturn ($ errorMock );
56
56
57
57
$ this ->result = new PackageResult ($ this ->storeManager , $ this ->errorFactory );
58
58
}
@@ -78,10 +78,9 @@ public function testComposing(): void
78
78
->setMethods (['getMethod ' , 'getPrice ' , 'setPrice ' ])
79
79
->getMock ();
80
80
$ price1 = 3 ;
81
- $ rate1 ->expects ($ this ->any ())->method ('getMethod ' )->willReturn ('method ' );
82
- $ rate1 ->expects ($ this ->any ())->method ('getPrice ' )->willReturnReference ($ price1 );
83
- $ rate1 ->expects ($ this ->any ())
84
- ->method ('setPrice ' )
81
+ $ rate1 ->method ('getMethod ' )->willReturn ('method ' );
82
+ $ rate1 ->method ('getPrice ' )->willReturnReference ($ price1 );
83
+ $ rate1 ->method ('setPrice ' )
85
84
->willReturnCallback (
86
85
function ($ price ) use (&$ price1 ) {
87
86
$ price1 = $ price ;
@@ -91,7 +90,7 @@ function ($price) use (&$price1) {
91
90
$ result1 = $ this ->getMockBuilder (Result::class)
92
91
->disableOriginalConstructor ()
93
92
->getMock ();
94
- $ result1 ->expects ( $ this -> any ())-> method ('getAllRates ' )->willReturn ([$ rate1 ]);
93
+ $ result1 ->method ('getAllRates ' )->willReturn ([$ rate1 ]);
95
94
$ result1 ->expects ($ this ->once ())
96
95
->method ('updateRatePrice ' )
97
96
->with (2 )
@@ -106,18 +105,17 @@ function () use (&$price1) {
106
105
->setMethods (['getMethod ' , 'getPrice ' , 'setPrice ' ])
107
106
->getMock ();
108
107
$ price2 = 4 ;
109
- $ rate2 ->expects ($ this ->any ())->method ('getMethod ' )->willReturn ('method ' );
110
- $ rate2 ->expects ($ this ->any ())->method ('getPrice ' )->willReturnReference ($ price2 );
111
- $ rate2 ->expects ($ this ->any ())
112
- ->method ('setPrice ' )
108
+ $ rate2 ->method ('getMethod ' )->willReturn ('method ' );
109
+ $ rate2 ->method ('getPrice ' )->willReturnReference ($ price2 );
110
+ $ rate2 ->method ('setPrice ' )
113
111
->willReturnCallback (
114
112
function ($ price ) use (&$ price2 ) {
115
113
$ price2 = $ price ;
116
114
}
117
115
);
118
116
/** @var Result|MockObject $result2 */
119
117
$ result2 = $ this ->getMockBuilder (Result::class)->disableOriginalConstructor ()->getMock ();
120
- $ result2 ->expects ( $ this -> any ())-> method ('getAllRates ' )->willReturn ([$ rate2 ]);
118
+ $ result2 ->method ('getAllRates ' )->willReturn ([$ rate2 ]);
121
119
$ result2 ->expects ($ this ->once ())
122
120
->method ('updateRatePrice ' )
123
121
->with (3 )
@@ -147,10 +145,9 @@ public function testAppendSameReference(): void
147
145
->setMethods (['getMethod ' , 'getPrice ' , 'setPrice ' ])
148
146
->getMock ();
149
147
$ price1 = 3 ;
150
- $ rate1 ->expects ($ this ->any ())->method ('getMethod ' )->willReturn ('method ' );
151
- $ rate1 ->expects ($ this ->any ())->method ('getPrice ' )->willReturnReference ($ price1 );
152
- $ rate1 ->expects ($ this ->any ())
153
- ->method ('setPrice ' )
148
+ $ rate1 ->method ('getMethod ' )->willReturn ('method ' );
149
+ $ rate1 ->method ('getPrice ' )->willReturnReference ($ price1 );
150
+ $ rate1 ->method ('setPrice ' )
154
151
->willReturnCallback (
155
152
function ($ price ) use (&$ price1 ) {
156
153
$ price1 = $ price ;
@@ -160,7 +157,7 @@ function ($price) use (&$price1) {
160
157
$ result1 = $ this ->getMockBuilder (Result::class)
161
158
->disableOriginalConstructor ()
162
159
->getMock ();
163
- $ result1 ->expects ( $ this -> any ())-> method ('getAllRates ' )->willReturn ([$ rate1 ]);
160
+ $ result1 ->method ('getAllRates ' )->willReturn ([$ rate1 ]);
164
161
165
162
$ this ->result ->appendPackageResult ($ result1 , 1 );
166
163
$ this ->result ->appendPackageResult ($ result1 , 2 );
0 commit comments