Skip to content

Commit

Permalink
Corrections to unit tests after the interface change to ExtractorInte…
Browse files Browse the repository at this point in the history
…rface.
  • Loading branch information
courtney-miles committed Aug 22, 2018
1 parent 02433be commit da0c1b0
Showing 1 changed file with 2 additions and 35 deletions.
37 changes: 2 additions & 35 deletions tests/Slurp/SlurpTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@ public function setUp()
->andReturnUsing(function ($row) {
return $row;
})->byDefault();

$this->mockExtractor->shouldReceive('getColumns')
->andReturn([])
->byDefault();
}

public function testGetSource()
Expand Down Expand Up @@ -170,36 +166,7 @@ protected function createSlurp(

protected function stubExtractorContent(MockInterface $mockExtractor, array $rowValues)
{
$this->stubIteratorMethods($mockExtractor, $rowValues);
}

/**
* @param MockInterface|\Iterator $mockIterator
* @param array $items
*/
protected function stubIteratorMethods(MockInterface $mockIterator, array $items)
{
$arrayIterator = new \ArrayIterator($items);

$mockIterator->shouldReceive('rewind')
->andReturnUsing(function () use ($arrayIterator) {
$arrayIterator->rewind();
});
$mockIterator->shouldReceive('current')
->andReturnUsing(function () use ($arrayIterator) {
return $arrayIterator->current();
});
$mockIterator->shouldReceive('key')
->andReturnUsing(function () use ($arrayIterator) {
return $arrayIterator->key();
});
$mockIterator->shouldReceive('next')
->andReturnUsing(function () use ($arrayIterator) {
$arrayIterator->next();
});
$mockIterator->shouldReceive('valid')
->andReturnUsing(function () use ($arrayIterator) {
return $arrayIterator->valid();
});
$mockExtractor->shouldReceive('getIterator')
->andReturn(new \ArrayObject($rowValues));
}
}

0 comments on commit da0c1b0

Please sign in to comment.