forked from ddeboer/DdeboerDataImportBundle
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove addFilterClosure, addConverterClosure and addWriterClosure met…
…hods
- Loading branch information
Showing
3 changed files
with
66 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
namespace Ddeboer\DataImportBundle\Tests; | ||
|
||
use Ddeboer\DataImportBundle\Workflow; | ||
use Ddeboer\DataImportBundle\Filter\CallbackFilter; | ||
use Ddeboer\DataImportBundle\Converter\CallbackConverter; | ||
use Ddeboer\DataImportBundle\Writer\CallbackWriter; | ||
|
||
class WorkflowTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
public function testAddCallbackFilter() | ||
{ | ||
$this->getWorkflow()->addFilter(new CallbackFilter(function($input) { | ||
return true; | ||
})); | ||
} | ||
|
||
public function testAddCallbackConverter() | ||
{ | ||
$this->getWorkflow()->addConverter('someField', new CallbackConverter(function($input) { | ||
return str_replace('-', '', $input); | ||
})); | ||
} | ||
|
||
public function testAddCallbackWriter() | ||
{ | ||
$this->getWorkflow()->addWriter(new CallbackWriter(function($item) { | ||
var_dump($item); | ||
})); | ||
} | ||
|
||
protected function getWorkflow() | ||
{ | ||
$reader = $this->getMockBuilder('\Ddeboer\DataImportBundle\Reader\CsvReader') | ||
->disableOriginalConstructor() | ||
->getMock(); | ||
|
||
return new Workflow($reader); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters