Skip to content

Commit

Permalink
Added Porter 4 support to tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Bilge committed Oct 28, 2017
1 parent d0ed6f8 commit 868c5f6
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 4 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -10,6 +10,7 @@ php:
- 5.6
- 7.0
- 7.1
- 7.2

env:
matrix:
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -9,7 +9,7 @@
],
"license": "LGPL-3.0",
"require": {
"scriptfusion/porter": ">=3,<5",
"scriptfusion/porter": "4.0.x-dev",
"scriptfusion/mapper": "^1|^2"
},
"require-dev": {
Expand Down
21 changes: 21 additions & 0 deletions test/FixtureFactory.php
@@ -0,0 +1,21 @@
<?php
namespace ScriptFUSIONTest;

use Psr\Container\ContainerInterface;
use ScriptFUSION\Porter\Porter;
use ScriptFUSION\StaticClass;

final class FixtureFactory
{
use StaticClass;

public static function createPorter()
{
return new Porter(
\Mockery::mock(ContainerInterface::class)
->shouldReceive('has')
->andReturn(false)
->getMock()
);
}
}
4 changes: 2 additions & 2 deletions test/Integration/Mapper/Strategy/SubImportTest.php
@@ -1,9 +1,9 @@
<?php
namespace ScriptFUSIONTest\Integration\Porter\Transform\Mapping\Mapper\Strategy;

use ScriptFUSION\Porter\Porter;
use ScriptFUSION\Porter\Specification\StaticDataImportSpecification;
use ScriptFUSION\Porter\Transform\Mapping\Mapper\Strategy\SubImport;
use ScriptFUSIONTest\FixtureFactory;

/**
* @see SubImport
Expand All @@ -17,7 +17,7 @@ public function testSpecificationCallbackCanCreateSpecification()
$import = new SubImport(function () use ($record) {
return new StaticDataImportSpecification(new \ArrayIterator([$record]));
});
$import->setPorter(new Porter);
$import->setPorter(FixtureFactory::createPorter());

$records = $import(null);

Expand Down
3 changes: 2 additions & 1 deletion test/Integration/MappingTransformerTest.php
Expand Up @@ -10,6 +10,7 @@
use ScriptFUSION\Porter\Transform\Mapping\Collection\CountableMappedRecords;
use ScriptFUSION\Porter\Transform\Mapping\Collection\MappedRecords;
use ScriptFUSION\Porter\Transform\Mapping\MappingTransformer;
use ScriptFUSIONTest\FixtureFactory;

final class MappingTransformerTest extends \PHPUnit_Framework_TestCase
{
Expand All @@ -22,7 +23,7 @@ final class MappingTransformerTest extends \PHPUnit_Framework_TestCase

protected function setUp()
{
$this->porter = new Porter;
$this->porter = FixtureFactory::createPorter();
}

public function testMappingTransformer()
Expand Down

0 comments on commit 868c5f6

Please sign in to comment.