@@ -76,9 +76,6 @@ protected function setUp()
76
76
$ this ->resourceMock = $ this ->getMockBuilder (Website::class)
77
77
->disableOriginalConstructor ()
78
78
->getMock ();
79
- $ this ->processorFactoryMock ->expects ($ this ->any ())
80
- ->method ('create ' )
81
- ->willReturn ($ this ->processorMock );
82
79
83
80
$ this ->model = new Importer (
84
81
$ this ->dataDifferenceCalculatorMock ,
@@ -97,9 +94,30 @@ public function testImport()
97
94
ScopeInterface::SCOPE_WEBSITES => ['websites ' ],
98
95
];
99
96
97
+ $ createProcessorMock = clone $ this ->processorMock ;
98
+ $ deleteProcessorMock = clone $ this ->processorMock ;
99
+ $ updateProcessorMock = clone $ this ->processorMock ;
100
+
101
+ $ this ->processorFactoryMock ->expects ($ this ->exactly (3 ))
102
+ ->method ('create ' )
103
+ ->withConsecutive (
104
+ [Importer \Processor \ProcessorFactory::TYPE_CREATE ],
105
+ [Importer \Processor \ProcessorFactory::TYPE_DELETE ],
106
+ [Importer \Processor \ProcessorFactory::TYPE_UPDATE ]
107
+ )->willReturnOnConsecutiveCalls (
108
+ $ createProcessorMock ,
109
+ $ deleteProcessorMock ,
110
+ $ updateProcessorMock
111
+ );
100
112
$ this ->resourceMock ->expects ($ this ->once ())
101
113
->method ('beginTransaction ' );
102
- $ this ->processorMock ->expects ($ this ->exactly (3 ))
114
+ $ createProcessorMock ->expects ($ this ->once ())
115
+ ->method ('run ' )
116
+ ->with ($ data );
117
+ $ deleteProcessorMock ->expects ($ this ->once ())
118
+ ->method ('run ' )
119
+ ->with ($ data );
120
+ $ updateProcessorMock ->expects ($ this ->once ())
103
121
->method ('run ' )
104
122
->with ($ data );
105
123
$ this ->resourceMock ->expects ($ this ->once ())
@@ -133,6 +151,9 @@ public function testImport()
133
151
*/
134
152
public function testImportWithException ()
135
153
{
154
+ $ this ->processorFactoryMock ->expects ($ this ->any ())
155
+ ->method ('create ' )
156
+ ->willReturn ($ this ->processorMock );
136
157
$ this ->resourceMock ->expects ($ this ->once ())
137
158
->method ('beginTransaction ' );
138
159
$ this ->processorMock ->expects ($ this ->any ())
0 commit comments