1212use ScriptFUSION \Porter \Connector \ConnectionContext ;
1313use ScriptFUSION \Porter \Connector \Connector ;
1414use ScriptFUSION \Porter \Connector \ConnectorOptions ;
15+ use ScriptFUSION \Porter \Connector \FetchExceptionHandler \FetchExceptionHandler ;
16+ use ScriptFUSION \Porter \Connector \FetchExceptionHandler \StatelessFetchExceptionHandler ;
1517use ScriptFUSION \Porter \Connector \ImportConnector ;
1618use ScriptFUSION \Porter \Connector \RecoverableConnectorException ;
1719use ScriptFUSION \Porter \ImportException ;
2527use ScriptFUSION \Porter \Specification \StaticDataImportSpecification ;
2628use ScriptFUSION \Porter \Transform \FilterTransformer ;
2729use ScriptFUSION \Porter \Transform \Transformer ;
28- use ScriptFUSION \Retry \ExceptionHandler \ExponentialBackoffExceptionHandler ;
2930use ScriptFUSION \Retry \FailingTooHardException ;
3031use ScriptFUSIONTest \MockFactory ;
3132
@@ -286,15 +287,17 @@ public function testUnrecoverableException()
286287 }
287288
288289 /**
289- * Tests that a when custom fetch exception handler is specified and the connector throws a recoverable exception
290+ * Tests that when a custom fetch exception handler is specified and the connector throws a recoverable exception
290291 * type, the handler is called on each retry.
291292 */
292293 public function testCustomFetchExceptionHandler ()
293294 {
294295 $ this ->specification ->setFetchExceptionHandler (
295- \Mockery::mock (ExponentialBackoffExceptionHandler::class)
296+ \Mockery::mock (FetchExceptionHandler::class)
297+ ->shouldReceive ('reset ' )
298+ ->once ()
296299 ->shouldReceive ('__invoke ' )
297- ->times (ImportSpecification::DEFAULT_FETCH_ATTEMPTS - 1 )
300+ ->times (ImportSpecification::DEFAULT_FETCH_ATTEMPTS - 1 )
298301 ->getMock ()
299302 );
300303
@@ -310,9 +313,9 @@ public function testCustomFetchExceptionHandler()
310313 */
311314 public function testCustomProviderFetchExceptionHandler ()
312315 {
313- $ this ->specification ->setFetchExceptionHandler (function () {
316+ $ this ->specification ->setFetchExceptionHandler (new StatelessFetchExceptionHandler ( function () {
314317 throw new \LogicException ('This exception must not be thrown! ' );
315- });
318+ })) ;
316319
317320 $ this ->arrangeConnectorException ($ connectorException =
318321 new RecoverableConnectorException ('This exception is caught by the provider handler. ' ));
0 commit comments