forked from FriendsOfSylius/SyliusImportExportPlugin
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use PropertyAccessor in Generic ResourceProcessor. Defined ImporterRe…
…sult as Service and injected it into the importes for better testing. Updated Readme
- Loading branch information
Matthias Alt
committed
Nov 18, 2017
1 parent
82ad8b5
commit 85cd304
Showing
16 changed files
with
333 additions
and
83 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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
suites: | ||
main: | ||
namespace: FriendsOfSylius\SyliusImportExportPlugin | ||
psr4_prefix: FriendsOfSylius\SyliusImportExportPlugin | ||
psr4_prefix: FriendsOfSylius\SyliusImportExportPlugin |
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,84 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace spec\FriendsOfSylius\SyliusImportExportPlugin\Importer; | ||
|
||
use FriendsOfSylius\SyliusImportExportPlugin\Importer\ImporterResult; | ||
use PhpSpec\ObjectBehavior; | ||
use Symfony\Component\Stopwatch\Stopwatch; | ||
use Symfony\Component\Stopwatch\StopwatchEvent; | ||
|
||
class ImporterResultSpec extends ObjectBehavior | ||
{ | ||
function let(Stopwatch $stopwatch) | ||
{ | ||
$this->beConstructedWith($stopwatch); | ||
} | ||
|
||
function it_is_initializable() | ||
{ | ||
$this->shouldHaveType(ImporterResult::class); | ||
} | ||
|
||
function it_can_start_the_stopwatch(Stopwatch $stopwatch) | ||
{ | ||
$stopwatch->start('import')->shouldBeCalled(); | ||
$this->start(); | ||
} | ||
|
||
function it_can_stop_the_stopwatch(Stopwatch $stopwatch) | ||
{ | ||
$stopwatch->stop('import')->shouldBeCalled(); | ||
$this->stop(); | ||
} | ||
|
||
function it_can_gather_successfull_line_numbers() | ||
{ | ||
$this->success(1); | ||
$this->success(2); | ||
$this->failed(3); | ||
$this->success(4); | ||
$this->skipped(5); | ||
|
||
$this->getSuccessRows()->shouldReturn( | ||
[1, 2, 4] | ||
); | ||
} | ||
|
||
function it_can_gather_failed_line_numbers() | ||
{ | ||
$this->success(1); | ||
$this->success(2); | ||
$this->failed(3); | ||
$this->success(4); | ||
$this->skipped(5); | ||
|
||
$this->getFailedRows()->shouldReturn( | ||
[3] | ||
); | ||
} | ||
|
||
function it_can_gather_skipped_rows() | ||
{ | ||
$this->success(1); | ||
$this->success(2); | ||
$this->failed(3); | ||
$this->success(4); | ||
$this->skipped(5); | ||
|
||
$this->getSkippedRows()->shouldReturn( | ||
[5] | ||
); | ||
} | ||
|
||
function it_can_return_the_duration_of_the_import(Stopwatch $stopwatch, StopwatchEvent $stopwatchEvent) | ||
{ | ||
$stopwatch->stop('import') | ||
->willReturn($stopwatchEvent); | ||
$stopwatchEvent->getDuration()->willReturn(1000); | ||
|
||
$this->stop(); | ||
$this->getDuration()->shouldReturn(1000); | ||
} | ||
} |
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
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,9 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace FriendsOfSylius\SyliusImportExportPlugin\Exception; | ||
|
||
class AccessorNotFoundException extends ImporterException | ||
{ | ||
} |
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
Oops, something went wrong.