@@ -46,14 +46,18 @@ protected function setUp()
46
46
$ this ->_request = $ this ->getMock (\Magento \Framework \App \Console \Request::class, [], [], '' , false );
47
47
$ this ->_responseMock = $ this ->getMock (\Magento \Framework \App \Console \Response::class, [], [], '' , false );
48
48
$ this ->objectManager = $ this ->getMockForAbstractClass (\Magento \Framework \ObjectManagerInterface::class);
49
- $ this ->_model = new Cron ($ this ->_stateMock , $ this ->_request , $ this ->_responseMock , $ this ->objectManager );
49
+ $ this ->_model = new Cron (
50
+ $ this ->_stateMock ,
51
+ $ this ->_request ,
52
+ $ this ->_responseMock ,
53
+ $ this ->objectManager ,
54
+ [],
55
+ $ this ->prepareAreaListMock ()
56
+ );
50
57
}
51
58
52
- public function testLaunchDispatchesCronEvent ()
59
+ protected function prepareAreaListMock ()
53
60
{
54
- $ configLoader = $ this ->getMockForAbstractClass (\Magento \Framework \ObjectManager \ConfigLoaderInterface::class);
55
- $ eventManagerMock = $ this ->getMock (\Magento \Framework \Event \ManagerInterface::class);
56
-
57
61
$ areaMock = $ this ->getMock (\Magento \Framework \App \Area::class, [], [], '' , false );
58
62
$ areaMock ->expects ($ this ->once ())
59
63
->method ('load ' )
@@ -65,12 +69,19 @@ public function testLaunchDispatchesCronEvent()
65
69
->with (Area::AREA_CRONTAB )
66
70
->willReturn ($ areaMock );
67
71
72
+ return $ areaListMock ;
73
+ }
74
+
75
+ public function testLaunchDispatchesCronEvent ()
76
+ {
77
+ $ configLoader = $ this ->getMockForAbstractClass (\Magento \Framework \ObjectManager \ConfigLoaderInterface::class);
78
+ $ eventManagerMock = $ this ->getMock (\Magento \Framework \Event \ManagerInterface::class);
79
+
68
80
$ this ->objectManager ->expects ($ this ->any ())
69
81
->method ('get ' )
70
82
->will ($ this ->returnValueMap ([
71
83
[\Magento \Framework \ObjectManager \ConfigLoaderInterface::class, $ configLoader ],
72
- [\Magento \Framework \Event \ManagerInterface::class, $ eventManagerMock ],
73
- [\Magento \Framework \App \AreaList::class, $ areaListMock ]
84
+ [\Magento \Framework \Event \ManagerInterface::class, $ eventManagerMock ]
74
85
]));
75
86
$ crontabConfig = ['config ' ];
76
87
$ configLoader ->expects ($ this ->once ())
0 commit comments