@@ -82,7 +82,7 @@ public function testImport()
8282
8383 self ::assertInstanceOf (PorterRecords::class, $ records );
8484 self ::assertNotSame ($ this ->specification , $ records ->getSpecification (), 'Specification was not cloned. ' );
85- self ::assertSame ('foo ' , $ records ->current ());
85+ self ::assertSame ([ 'foo ' ] , $ records ->current ());
8686
8787 /** @var ProviderRecords $previous */
8888 self ::assertInstanceOf (ProviderRecords::class, $ previous = $ records ->getPreviousCollection ());
@@ -167,7 +167,7 @@ public function testImportCustomProviderName()
167167 );
168168
169169 $ records = $ this ->porter ->import (
170- (new ImportSpecification (MockFactory::mockResource ($ provider , new \ArrayIterator ([$ output = 'bar ' ]))))
170+ (new ImportSpecification (MockFactory::mockResource ($ provider , new \ArrayIterator ([$ output = [ 'bar ' ] ]))))
171171 ->setProviderName ($ providerName )
172172 );
173173
@@ -212,7 +212,7 @@ public function testImportOne()
212212 {
213213 $ result = $ this ->porter ->importOne ($ this ->specification );
214214
215- self ::assertSame ('foo ' , $ result );
215+ self ::assertSame ([ 'foo ' ] , $ result );
216216 }
217217
218218 public function testImportOneOfNone ()
@@ -226,7 +226,7 @@ public function testImportOneOfNone()
226226
227227 public function testImportOneOfMany ()
228228 {
229- $ this ->resource ->shouldReceive ('fetch ' )->andReturn (new \ArrayIterator (['foo ' , 'bar ' ]));
229+ $ this ->resource ->shouldReceive ('fetch ' )->andReturn (new \ArrayIterator ([[ 'foo ' ], [ 'bar ' ] ]));
230230
231231 $ this ->setExpectedException (ImportException::class);
232232 $ this ->porter ->importOne ($ this ->specification );
@@ -343,17 +343,23 @@ function (\Exception $exception) use ($connectorException) {
343343
344344 public function testFilter ()
345345 {
346- $ this ->resource ->shouldReceive ('fetch ' )->andReturn (new \ArrayIterator (range (1 , 10 )));
346+ $ this ->resource ->shouldReceive ('fetch ' )->andReturnUsing (
347+ static function () {
348+ foreach (range (1 , 10 ) as $ i ) {
349+ yield [$ i ];
350+ }
351+ }
352+ );
347353
348354 $ records = $ this ->porter ->import (
349355 $ this ->specification
350356 ->addTransformer (new FilterTransformer ($ filter = function ($ record ) {
351- return $ record % 2 ;
357+ return $ record[ 0 ] % 2 ;
352358 }))
353359 );
354360
355361 self ::assertInstanceOf (PorterRecords::class, $ records );
356- self ::assertSame ([1 , 3 , 5 , 7 , 9 ], iterator_to_array ($ records ));
362+ self ::assertSame ([[ 1 ], [ 3 ], [ 5 ], [ 7 ], [ 9 ] ], iterator_to_array ($ records ));
357363
358364 /** @var FilteredRecords $previous */
359365 self ::assertInstanceOf (FilteredRecords::class, $ previous = $ records ->getPreviousCollection ());
0 commit comments