@@ -49,24 +49,24 @@ public function testExecuteBackupFound()
49
49
$ size = 10 ;
50
50
$ output = 'test ' ;
51
51
52
- $ this ->backup ->expects ($ this ->once ())->method ('getTime ' )->will ( $ this -> returnValue ( $ time) );
53
- $ this ->backup ->expects ($ this ->once ())->method ('exists ' )->will ( $ this -> returnValue ( true ) );
54
- $ this ->backup ->expects ($ this ->once ())->method ('getSize ' )->will ( $ this -> returnValue ( $ size) );
55
- $ this ->backup ->expects ($ this ->once ())->method ('output ' )->will ( $ this -> returnValue ( $ output) );
52
+ $ this ->backup ->expects ($ this ->once ())->method ('getTime ' )->willReturn ( $ time );
53
+ $ this ->backup ->expects ($ this ->once ())->method ('exists ' )->willReturn ( true );
54
+ $ this ->backup ->expects ($ this ->once ())->method ('getSize ' )->willReturn ( $ size );
55
+ $ this ->backup ->expects ($ this ->once ())->method ('output ' )->willReturn ( $ output );
56
56
57
- $ this ->request ->expects ($ this ->at (0 ))->method ('getParam ' )->with ('time ' )->will ( $ this -> returnValue ( $ time) );
58
- $ this ->request ->expects ($ this ->at (1 ))->method ('getParam ' )->with ('type ' )->will ( $ this -> returnValue ( $ type) );
57
+ $ this ->request ->expects ($ this ->at (0 ))->method ('getParam ' )->with ('time ' )->willReturn ( $ time );
58
+ $ this ->request ->expects ($ this ->at (1 ))->method ('getParam ' )->with ('type ' )->willReturn ( $ type );
59
59
60
60
$ this ->backupModelFactory ->expects ($ this ->once ())->method ('create ' )->with ($ time , $ type )
61
- ->will ($ this ->returnValue ( $ this -> backup ) );
61
+ ->willReturn ($ this ->backup );
62
62
63
63
$ helper = $ this ->getMock ('Magento\Backup\Helper\Data ' , [], [], '' , false );
64
64
$ helper ->expects ($ this ->once ())->method ('generateBackupDownloadName ' )->with ($ this ->backup )
65
- ->will ( $ this -> returnValue ( $ filename) );
65
+ ->willReturn ( $ filename );
66
66
67
67
$ objectManager = $ this ->getMock ('\Magento\Framework\ObjectManagerInterface ' , [], [], '' , false );
68
68
$ objectManager ->expects ($ this ->once ())->method ('get ' )->with ('Magento\Backup\Helper\Data ' )
69
- ->will ( $ this -> returnValue ( $ helper) );
69
+ ->willReturn ( $ helper );
70
70
71
71
$ fileFactory = $ this ->getMock ('\Magento\Framework\App\Response\Http\FileFactory ' , [], [], '' , false );
72
72
$ fileFactory ->expects ($ this ->once ())->method ('create ' )->with (
@@ -75,7 +75,7 @@ public function testExecuteBackupFound()
75
75
\Magento \Framework \App \Filesystem \DirectoryList::VAR_DIR ,
76
76
'application/octet-stream ' ,
77
77
$ size
78
- )->will ($ this ->returnValue ( $ this -> response ) );
78
+ )->willReturn ($ this ->response );
79
79
80
80
$ resultRaw = $ this ->getMock ('\Magento\Framework\Controller\Result\Raw ' , [], [], '' , false );
81
81
$ resultRaw ->expects ($ this ->once ())->method ('setContents ' )->with ($ output );
@@ -87,12 +87,12 @@ public function testExecuteBackupFound()
87
87
'' ,
88
88
false
89
89
);
90
- $ resultRawFactory ->expects ($ this ->once ())->method ('create ' )->will ( $ this -> returnValue ( $ resultRaw) );
90
+ $ resultRawFactory ->expects ($ this ->once ())->method ('create ' )->willReturn ( $ resultRaw );
91
91
92
92
$ context = $ this ->getMock ('\Magento\Backend\App\Action\Context ' , [], [], '' , false );
93
- $ context ->expects ($ this ->once ())->method ('getRequest ' )->will ($ this ->returnValue ( $ this -> request ) );
94
- $ context ->expects ($ this ->once ())->method ('getObjectManager ' )->will ( $ this -> returnValue ( $ objectManager) );
95
- $ context ->expects ($ this ->once ())->method ('getResponse ' )->will ($ this ->returnValue ( $ this -> response ) );
93
+ $ context ->expects ($ this ->once ())->method ('getRequest ' )->willReturn ($ this ->request );
94
+ $ context ->expects ($ this ->once ())->method ('getObjectManager ' )->willReturn ( $ objectManager );
95
+ $ context ->expects ($ this ->once ())->method ('getResponse ' )->willReturn ($ this ->response );
96
96
97
97
/** @var Download|\PHPUnit_Framework_MockObject_MockObject $controller */
98
98
$ controller = (new \Magento \TestFramework \Helper \ObjectManager ($ this ))->getObject (
@@ -111,25 +111,24 @@ public function testExecuteBackupFound()
111
111
* @dataProvider executeBackupNotFoundDataProvider
112
112
* @param string $time
113
113
* @param bool $exists
114
- * @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $existsCount
114
+ * @param int $existsCount
115
115
*/
116
116
public function testExecuteBackupNotFound ($ time , $ exists , $ existsCount )
117
117
{
118
118
$ type = 'db ' ;
119
119
120
- $ this ->backup ->expects ($ this ->once ())->method ('getTime ' )->will ( $ this -> returnValue ( $ time) );
121
- $ this ->backup ->expects ($ existsCount )->method ('exists ' )->will ( $ this -> returnValue ( $ exists) );
120
+ $ this ->backup ->expects ($ this ->once ())->method ('getTime ' )->willReturn ( $ time );
121
+ $ this ->backup ->expects ($ this -> exactly ( $ existsCount )) ->method ('exists ' )->willReturn ( $ exists );
122
122
123
- $ this ->request = $ this ->getMock ('\Magento\Framework\App\RequestInterface ' , [], [], '' , false );
124
123
$ this ->request ->expects ($ this ->at (0 ))->method ('getParam ' )->with ('time ' )->will ($ this ->returnValue ($ time ));
125
124
$ this ->request ->expects ($ this ->at (1 ))->method ('getParam ' )->with ('type ' )->will ($ this ->returnValue ($ type ));
126
125
127
126
$ context = $ this ->getMock ('\Magento\Backend\App\Action\Context ' , [], [], '' , false );
128
- $ context ->expects ($ this ->once ())->method ('getRequest ' )->will ($ this ->returnValue ( $ this -> request ) );
129
- $ context ->expects ($ this ->once ())->method ('getResponse ' )->will ($ this ->returnValue ( $ this -> response ) );
127
+ $ context ->expects ($ this ->once ())->method ('getRequest ' )->willReturn ($ this ->request );
128
+ $ context ->expects ($ this ->once ())->method ('getResponse ' )->willReturn ($ this ->response );
130
129
131
130
$ this ->backupModelFactory ->expects ($ this ->once ())->method ('create ' )->with ($ time , $ type )
132
- ->will ($ this ->returnValue ( $ this -> backup ) );
131
+ ->willReturn ($ this ->backup );
133
132
134
133
$ resultRedirect = $ this ->getMock ('Magento\Backend\Model\View\Result\Redirect ' , [], [], '' , false );
135
134
$ resultRedirect ->expects ($ this ->once ())->method ('setPath ' )->with ('backup/* ' );
@@ -141,7 +140,7 @@ public function testExecuteBackupNotFound($time, $exists, $existsCount)
141
140
'' ,
142
141
false
143
142
);
144
- $ resultRedirectFactory ->expects ($ this ->once ())->method ('create ' )->will ( $ this -> returnValue ( $ resultRedirect) );
143
+ $ resultRedirectFactory ->expects ($ this ->once ())->method ('create ' )->willReturn ( $ resultRedirect );
145
144
146
145
/** @var Download|\PHPUnit_Framework_MockObject_MockObject $controller */
147
146
$ controller = (new \Magento \TestFramework \Helper \ObjectManager ($ this ))->getObject (
@@ -161,9 +160,9 @@ public function testExecuteBackupNotFound($time, $exists, $existsCount)
161
160
public function executeBackupNotFoundDataProvider ()
162
161
{
163
162
return [
164
- [1 , false , $ this -> once () ],
165
- [0 , true , $ this -> never () ],
166
- [0 , false , $ this -> never () ]
163
+ [1 , false , 1 ],
164
+ [0 , true , 0 ],
165
+ [0 , false , 0 ]
167
166
];
168
167
}
169
168
}
0 commit comments