@@ -32,17 +32,9 @@ protected function setUp()
32
32
$ this ->imageBuilderMock = $ this ->getMockBuilder (\Magento \Catalog \Block \Product \ImageBuilder::class)
33
33
->disableOriginalConstructor ()
34
34
->getMock ();
35
- $ this ->storeManagerMock = $ this ->getMockBuilder (\Magento \Store \Model \StoreManagerInterface::class)
36
- ->disableOriginalConstructor ()
37
- ->getMock ();
38
- $ this ->emulationMock = $ this ->getMockBuilder (\Magento \Store \Model \App \Emulation::class)
39
- ->disableOriginalConstructor ()
40
- ->getMock ();
41
35
42
36
$ this ->model = new \Magento \ProductAlert \Block \Product \ImageProvider (
43
- $ this ->imageBuilderMock ,
44
- $ this ->storeManagerMock ,
45
- $ this ->emulationMock
37
+ $ this ->imageBuilderMock
46
38
);
47
39
}
48
40
@@ -56,44 +48,11 @@ public function testGetImage()
56
48
57
49
$ productMock = $ this ->createMock (\Magento \Catalog \Model \Product::class);
58
50
$ imageMock = $ this ->createMock (\Magento \Catalog \Block \Product \Image::class);
59
- $ storeMock = $ this ->createMock (\Magento \Store \Api \Data \StoreInterface::class);
60
-
61
- $ this ->storeManagerMock ->expects ($ this ->atLeastOnce ())->method ('getStore ' )->willReturn ($ storeMock );
62
- $ this ->emulationMock ->expects ($ this ->once ())->method ('startEnvironmentEmulation ' );
63
51
$ this ->imageBuilderMock ->expects ($ this ->once ())
64
52
->method ('create ' )
65
53
->with ($ productMock , $ imageId , $ attributes )
66
54
->willReturn ($ imageMock );
67
- $ this ->emulationMock ->expects ($ this ->once ())->method ('stopEnvironmentEmulation ' );
68
55
69
56
$ this ->assertEquals ($ imageMock , $ this ->model ->getImage ($ productMock , $ imageId , $ attributes ));
70
57
}
71
-
72
- /**
73
- * Test that app emulation stops when exception occurs.
74
- *
75
- * @expectedException \Exception
76
- * @expectedExceptionMessage Image Builder Exception
77
- */
78
- public function testGetImageThrowsAnException ()
79
- {
80
- $ imageId = 1 ;
81
- $ productMock = $ this ->getMockBuilder (\Magento \Catalog \Model \Product::class)
82
- ->disableOriginalConstructor ()
83
- ->getMock ();
84
- $ storeMock = $ this ->getMockBuilder (\Magento \Store \Api \Data \StoreInterface::class)
85
- ->disableOriginalConstructor ()
86
- ->getMock ();
87
-
88
- $ this ->emulationMock ->expects ($ this ->once ())->method ('startEnvironmentEmulation ' );
89
- $ this ->storeManagerMock ->expects ($ this ->atLeastOnce ())->method ('getStore ' )->willReturn ($ storeMock );
90
-
91
- $ this ->imageBuilderMock ->expects ($ this ->once ())
92
- ->method ('create ' )
93
- ->with ($ productMock , $ imageId )
94
- ->willThrowException (new \Exception ("Image Builder Exception " ));
95
-
96
- $ this ->emulationMock ->expects ($ this ->once ())->method ('stopEnvironmentEmulation ' );
97
- $ this ->model ->getImage ($ productMock , $ imageId );
98
- }
99
58
}
0 commit comments