11
11
use Magento \Store \Model \App \Emulation ;
12
12
13
13
/**
14
- * Class ObserverTest
14
+ * Class for ObserverTest
15
15
*
16
16
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
17
17
*/
@@ -28,54 +28,55 @@ class ObserverTest extends \PHPUnit\Framework\TestCase
28
28
private $ observer ;
29
29
30
30
/**
31
- * @var \Magento\Framework\App\Config\ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject
31
+ * @var \Magento\Framework\App\Config\ScopeConfigInterface|\PHPUnit\Framework\MockObject\MockObject
32
32
*/
33
33
private $ scopeConfigMock ;
34
34
35
35
/**
36
- * @var \Magento\Sitemap\Model\ResourceModel\Sitemap\CollectionFactory|\PHPUnit_Framework_MockObject_MockObject
36
+ * @var \Magento\Sitemap\Model\ResourceModel\Sitemap\CollectionFactory|\PHPUnit\Framework\MockObject\MockObject
37
37
*/
38
38
private $ collectionFactoryMock ;
39
39
40
40
/**
41
- * @var \Magento\Sitemap\Model\ResourceModel\Sitemap\Collection|\PHPUnit_Framework_MockObject_MockObject
41
+ * @var \Magento\Sitemap\Model\ResourceModel\Sitemap\Collection|\PHPUnit\Framework\MockObject\MockObject
42
42
*/
43
43
private $ sitemapCollectionMock ;
44
44
45
45
/**
46
- * @var \Magento\Sitemap\Model\Sitemap|\PHPUnit_Framework_MockObject_MockObject
46
+ * @var \Magento\Sitemap\Model\Sitemap|\PHPUnit\Framework\MockObject\MockObject
47
47
*/
48
48
private $ sitemapMock ;
49
49
50
50
/**
51
- * @var \Magento\Framework\ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject
51
+ * @var \Magento\Framework\ObjectManagerInterface|\PHPUnit\Framework\MockObject\MockObject
52
52
*/
53
53
private $ objectManagerMock ;
54
54
55
55
/**
56
- * @var Emulation|\PHPUnit_Framework_MockObject_MockObject
56
+ * @var Emulation|\PHPUnit\Framework\MockObject\MockObject
57
57
*/
58
58
private $ appEmulationMock ;
59
59
60
60
/**
61
- * @var EmailNotification|\PHPUnit_Framework_MockObject_MockObject
61
+ * @var EmailNotification|\PHPUnit\Framework\MockObject\MockObject
62
62
*/
63
63
private $ emailNotificationMock ;
64
64
65
65
protected function setUp ()
66
66
{
67
- $ this ->objectManagerMock = $ this ->getMockBuilder (\Magento \Framework \ObjectManagerInterface::class)
68
- ->getMock ();
69
- $ this ->scopeConfigMock = $ this ->getMockBuilder (\Magento \Framework \App \Config \ScopeConfigInterface::class)
70
- ->getMock ();
67
+ $ this ->objectManagerMock = $ this ->createMock (
68
+ \Magento \Framework \ObjectManagerInterface::class
69
+ );
70
+ $ this ->scopeConfigMock = $ this ->createMock (
71
+ \Magento \Framework \App \Config \ScopeConfigInterface::class
72
+ );
71
73
$ this ->collectionFactoryMock = $ this ->getMockBuilder (
72
74
\Magento \Sitemap \Model \ResourceModel \Sitemap \CollectionFactory::class
73
75
)->disableOriginalConstructor ()
74
76
->setMethods (['create ' ])
75
77
->getMock ();
76
- $ this ->sitemapCollectionMock = $ this ->createPartialMock (
77
- \Magento \Sitemap \Model \ResourceModel \Sitemap \Collection::class,
78
- ['getIterator ' ]
78
+ $ this ->sitemapCollectionMock = $ this ->createMock (
79
+ \Magento \Sitemap \Model \ResourceModel \Sitemap \Collection::class
79
80
);
80
81
$ this ->sitemapMock = $ this ->createPartialMock (
81
82
\Magento \Sitemap \Model \Sitemap::class,
@@ -130,6 +131,10 @@ public function testScheduledGenerateSitemapsSendsExceptionEmail()
130
131
)
131
132
->
willReturn (
'[email protected] ' );
132
133
134
+ $ this ->emailNotificationMock ->expects ($ this ->once ())
135
+ ->method ('sendErrors ' )
136
+ ->with ([$ exception ]);
137
+
133
138
$ this ->observer ->scheduledGenerateSitemaps ();
134
139
}
135
140
}
0 commit comments