@@ -46,18 +46,42 @@ 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
+ );
57
+ }
58
+
59
+ protected function prepareAreaListMock ()
60
+ {
61
+ $ areaMock = $ this ->getMock (\Magento \Framework \App \Area::class, [], [], '' , false );
62
+ $ areaMock ->expects ($ this ->once ())
63
+ ->method ('load ' )
64
+ ->with (Area::PART_TRANSLATE );
65
+
66
+ $ areaListMock = $ this ->getMock (\Magento \Framework \App \AreaList::class, [], [], '' , false );
67
+ $ areaListMock ->expects ($ this ->any ())
68
+ ->method ('getArea ' )
69
+ ->with (Area::AREA_CRONTAB )
70
+ ->willReturn ($ areaMock );
71
+
72
+ return $ areaListMock ;
50
73
}
51
74
52
75
public function testLaunchDispatchesCronEvent ()
53
76
{
54
77
$ configLoader = $ this ->getMockForAbstractClass (\Magento \Framework \ObjectManager \ConfigLoaderInterface::class);
55
78
$ eventManagerMock = $ this ->getMock (\Magento \Framework \Event \ManagerInterface::class);
79
+
56
80
$ this ->objectManager ->expects ($ this ->any ())
57
81
->method ('get ' )
58
82
->will ($ this ->returnValueMap ([
59
83
[\Magento \Framework \ObjectManager \ConfigLoaderInterface::class, $ configLoader ],
60
- [\Magento \Framework \Event \ManagerInterface::class, $ eventManagerMock ],
84
+ [\Magento \Framework \Event \ManagerInterface::class, $ eventManagerMock ]
61
85
]));
62
86
$ crontabConfig = ['config ' ];
63
87
$ configLoader ->expects ($ this ->once ())
0 commit comments