@@ -12,6 +12,7 @@ class JobUpgradeTest extends \PHPUnit_Framework_TestCase
12
12
public function testExecute ()
13
13
{
14
14
$ queue = $ this ->getMock ('Magento\Setup\Model\Cron\Queue ' , [], [], '' , false );
15
+ $ queue ->expects ($ this ->exactly (3 ))->method ('addJobs ' );
15
16
$ command = $ this ->getMock ('Magento\Setup\Console\Command\UpgradeCommand ' , [], [], '' , false );
16
17
$ command ->expects ($ this ->once ())->method ('run ' );
17
18
$ status = $ this ->getMock ('Magento\Setup\Model\Cron\Status ' , [], [], '' , false );
@@ -20,6 +21,30 @@ public function testExecute()
20
21
$ objectManagerProvider = $ this ->getMock ('Magento\Setup\Model\ObjectManagerProvider ' , ['get ' ], [], '' , false );
21
22
$ objectManagerProvider ->expects ($ this ->once ())->method ('get ' )->willReturn ($ objectManager );
22
23
24
+ $ cleanupFiles = $ this ->getMock ('\Magento\Framework\App\State\CleanupFiles ' , [], [], '' , false );
25
+ $ cache = $ this ->getMock ('\Magento\Framework\App\Cache ' , [], [], '' , false );
26
+
27
+ $ pathToCacheStatus = '/path/to/cachefile ' ;
28
+ $ writeFactory = $ this ->getMock ('\Magento\Framework\Filesystem\Directory\WriteFactory ' , [], [], '' , false );
29
+ $ write = $ this ->getMock ('\Magento\Framework\Filesystem\Directory\Write ' , [], [], '' , false );
30
+ $ write ->expects ($ this ->once ())->method ('isExist ' )->with ('/path/to/cachefile ' )->willReturn (true );
31
+ $ write ->expects ($ this ->once ())->method ('readFile ' )->with ('/path/to/cachefile ' )->willReturn (
32
+ '{"cacheOne":1,"cacheTwo":1,"cacheThree":1} '
33
+ );
34
+ $ write ->expects ($ this ->once ())->method ('delete ' )->with ('/path/to/cachefile ' )->willReturn (true );
35
+ $ write ->expects ($ this ->once ())->method ('getRelativePath ' )->willReturn ($ pathToCacheStatus );
36
+
37
+ $ writeFactory ->expects ($ this ->once ())->method ('create ' )->willReturn ($ write );
38
+ $ directoryList = $ this ->getMock ('\Magento\Framework\App\Filesystem\DirectoryList ' , [], [], '' , false );
39
+ $ directoryList ->expects ($ this ->once ())->method ('getPath ' )->willReturn ( '/some/full/path ' . $ pathToCacheStatus );
40
+
41
+ $ objectManager ->expects ($ this ->any ())->method ('get ' )->will ($ this ->returnValueMap ([
42
+ ['\Magento\Framework\Filesystem\Directory\WriteFactory ' , $ writeFactory ],
43
+ ['\Magento\Framework\App\Filesystem\DirectoryList ' , $ directoryList ],
44
+ ['\Magento\Framework\App\State\CleanupFiles ' , $ cleanupFiles ],
45
+ ['\Magento\Framework\App\Cache ' , $ cache ],
46
+ ]));
47
+
23
48
$ jobUpgrade = new JobUpgrade (
24
49
$ command ,
25
50
$ objectManagerProvider ,
0 commit comments