3
3
* Copyright © Magento, Inc. All rights reserved.
4
4
* See COPYING.txt for license details.
5
5
*/
6
+ declare (strict_types=1 );
6
7
7
8
namespace Magento \AdminNotification \Test \Unit \Model ;
8
9
@@ -70,13 +71,12 @@ protected function setUp(): void
70
71
['create ' ]
71
72
);
72
73
$ this ->curlFactory = $ this ->createPartialMock (CurlFactory::class, ['create ' ]);
73
- $ this ->curl = $ this ->getMockBuilder (Curl::class)
74
- ->disableOriginalConstructor ()->getMock ();
74
+ $ this ->curl = $ this ->createMock (Curl::class);
75
75
$ this ->appState = $ this ->createPartialMock (State::class, []);
76
76
$ this ->inboxModel = $ this ->createPartialMock (Inbox::class, [
77
- '__wakeup ' ,
78
- 'parse '
79
- ]);
77
+ '__wakeup ' ,
78
+ 'parse '
79
+ ]);
80
80
$ this ->backendConfig = $ this ->createPartialMock (
81
81
ConfigInterface::class,
82
82
[
@@ -96,15 +96,13 @@ protected function setUp(): void
96
96
]
97
97
);
98
98
99
- $ this ->deploymentConfig = $ this ->getMockBuilder (DeploymentConfig::class)
100
- ->disableOriginalConstructor ()->getMock ();
99
+ $ this ->deploymentConfig = $ this ->createMock (DeploymentConfig::class);
101
100
102
101
$ this ->objectManagerHelper = new ObjectManagerHelper ($ this );
103
102
104
- $ this ->productMetadata = $ this ->getMockBuilder (ProductMetadata::class)
105
- ->disableOriginalConstructor ()->getMock ();
103
+ $ this ->productMetadata = $ this ->createMock (ProductMetadata::class);
106
104
107
- $ this ->urlBuilder = $ this ->createMock (UrlInterface::class);
105
+ $ this ->urlBuilder = $ this ->getMockForAbstractClass (UrlInterface::class);
108
106
109
107
$ this ->feed = $ this ->objectManagerHelper ->getObject (
110
108
Feed::class,
@@ -145,20 +143,20 @@ public function testCheckUpdate($callInbox, $curlRequest)
145
143
];
146
144
147
145
$ lastUpdate = 0 ;
148
- $ this ->cacheManager ->expects ($ this ->once ())->method ('load ' )->will (( $ this -> returnValue ( $ lastUpdate)) );
149
- $ this ->curlFactory ->expects ($ this ->at (0 ))->method ('create ' )->will ($ this ->returnValue ( $ this -> curl ) );
146
+ $ this ->cacheManager ->expects ($ this ->once ())->method ('load ' )->willReturn ( $ lastUpdate );
147
+ $ this ->curlFactory ->expects ($ this ->at (0 ))->method ('create ' )->willReturn ($ this ->curl );
150
148
$ this ->curl ->expects ($ this ->once ())->method ('setConfig ' )->with ($ configValues )->willReturnSelf ();
151
- $ this ->curl ->expects ($ this ->once ())->method ('read ' )->will ( $ this -> returnValue ( $ curlRequest) );
152
- $ this ->backendConfig ->expects ($ this ->at (0 ))->method ('getValue ' )->will ( $ this -> returnValue ( '1 ' ) );
153
- $ this ->backendConfig ->expects ($ this ->once ())->method ('isSetFlag ' )->will ( $ this -> returnValue ( false ) );
149
+ $ this ->curl ->expects ($ this ->once ())->method ('read ' )->willReturn ( $ curlRequest );
150
+ $ this ->backendConfig ->expects ($ this ->at (0 ))->method ('getValue ' )->willReturn ( '1 ' );
151
+ $ this ->backendConfig ->expects ($ this ->once ())->method ('isSetFlag ' )->willReturn ( false );
154
152
$ this ->backendConfig ->expects ($ this ->at (1 ))->method ('getValue ' )
155
- ->will ( $ this -> returnValue ( 'http://feed.magento.com ' ) );
153
+ ->willReturn ( 'http://feed.magento.com ' );
156
154
$ this ->deploymentConfig ->expects ($ this ->once ())->method ('get ' )
157
155
->with (ConfigOptionsListConstants::CONFIG_PATH_INSTALL_DATE )
158
- ->will ( $ this -> returnValue ( 'Sat, 6 Sep 2014 16:46:11 UTC ' ) );
156
+ ->willReturn ( 'Sat, 6 Sep 2014 16:46:11 UTC ' );
159
157
if ($ callInbox ) {
160
158
$ this ->inboxFactory ->expects ($ this ->once ())->method ('create ' )
161
- ->will ($ this ->returnValue ( $ this -> inboxModel ) );
159
+ ->willReturn ($ this ->inboxModel );
162
160
$ this ->inboxModel ->expects ($ this ->once ())
163
161
->method ('parse ' )
164
162
->with (
@@ -178,7 +176,7 @@ function ($initialValue, $item) use ($data) {
178
176
}
179
177
)
180
178
)
181
- ->will ( $ this -> returnSelf () );
179
+ ->willReturnSelf ( );
182
180
} else {
183
181
$ this ->inboxFactory ->expects ($ this ->never ())->method ('create ' );
184
182
$ this ->inboxModel ->expects ($ this ->never ())->method ('parse ' );
0 commit comments