File tree Expand file tree Collapse file tree 8 files changed +105
-4
lines changed Expand file tree Collapse file tree 8 files changed +105
-4
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " scriptfusion/porter" ,
3- "description" : " Scalable and efficient data import abstraction for APIs." ,
3+ "description" : " Scalable and durable data import abstraction for APIs." ,
44 "authors" : [
55 {
66 "name" : " Bilge" ,
Original file line number Diff line number Diff line change 1111 "logs" : {
1212 "text" : " infection.log" ,
1313 "badge" : {
14- "branch" : " 5.0 "
14+ "branch" : " master "
1515 }
1616 },
1717 "mutators" : {
Original file line number Diff line number Diff line change 2727use ScriptFUSION \Retry \FailingTooHardException ;
2828use ScriptFUSIONTest \MockFactory ;
2929use ScriptFUSIONTest \Stubs \TestRecoverableException ;
30+ use ScriptFUSIONTest \Stubs \TestRecoverableExceptionHandler ;
3031
3132final class PorterSyncTest extends PorterTest
3233{
@@ -235,6 +236,8 @@ public function testDerivedRecoverableException(): void
235236 public function testDefaultTries (): void
236237 {
237238 $ this ->arrangeConnectorException (new TestRecoverableException );
239+ // Speed up test by circumventing exponential backoff default handler.
240+ $ this ->specification ->setRecoverableExceptionHandler (new TestRecoverableExceptionHandler );
238241
239242 $ this ->expectException (FailingTooHardException::class);
240243 $ this ->expectExceptionMessage ((string )ImportSpecification::DEFAULT_FETCH_ATTEMPTS );
Original file line number Diff line number Diff line change 1+ <?php
2+ declare (strict_types=1 );
3+
4+ namespace ScriptFUSIONTest \Unit \Collection ;
5+
6+ use Amp \Iterator ;
7+ use PHPUnit \Framework \TestCase ;
8+ use ScriptFUSION \Porter \Collection \AsyncFilteredRecords ;
9+ use ScriptFUSION \Porter \Collection \AsyncRecordCollection ;
10+
11+ /**
12+ * @see AsyncFilteredRecords
13+ */
14+ final class AsyncFilteredRecordsTest extends TestCase
15+ {
16+ /**
17+ * Tests that the filter passed at construction time is the same as that retrieved from the accessor method.
18+ */
19+ public function testGetResource (): void
20+ {
21+ $ records = new AsyncFilteredRecords (
22+ \Mockery::mock (Iterator::class),
23+ \Mockery::mock (AsyncRecordCollection::class),
24+ $ callable = [$ this , __FUNCTION__ ]
25+ );
26+
27+ self ::assertSame ($ callable , $ records ->getFilter ());
28+ }
29+ }
Original file line number Diff line number Diff line change 1+ <?php
2+ declare (strict_types=1 );
3+
4+ namespace ScriptFUSIONTest \Unit \Collection ;
5+
6+ use PHPUnit \Framework \TestCase ;
7+ use ScriptFUSION \Porter \Collection \AsyncPorterRecords ;
8+ use ScriptFUSION \Porter \Collection \AsyncRecordCollection ;
9+ use ScriptFUSION \Porter \Specification \AsyncImportSpecification ;
10+
11+ /**
12+ * @see AsyncPorterRecords
13+ */
14+ final class AsyncPorterRecordsTest extends TestCase
15+ {
16+ /**
17+ * Tests that the specification passed at construction time is the same as that retrieved from the accessor method.
18+ */
19+ public function testGetSpecification (): void
20+ {
21+ $ records = new AsyncPorterRecords (
22+ \Mockery::mock (AsyncRecordCollection::class),
23+ $ specification = \Mockery::mock (AsyncImportSpecification::class)
24+ );
25+
26+ self ::assertSame ($ specification , $ records ->getSpecification ());
27+ }
28+ }
Original file line number Diff line number Diff line change 1+ <?php
2+ declare (strict_types=1 );
3+
4+ namespace ScriptFUSIONTest \Unit \Collection ;
5+
6+ use Amp \Iterator ;
7+ use PHPUnit \Framework \TestCase ;
8+ use ScriptFUSION \Porter \Collection \AsyncProviderRecords ;
9+ use ScriptFUSION \Porter \Collection \ProviderRecords ;
10+ use ScriptFUSION \Porter \Provider \Resource \AsyncResource ;
11+
12+ /**
13+ * @see ProviderRecords
14+ */
15+ final class AsyncProviderRecordsTest extends TestCase
16+ {
17+ /**
18+ * Tests that the resource passed at construction time is the same as that retrieved from the accessor method.
19+ */
20+ public function testGetResource (): void
21+ {
22+ $ records = new AsyncProviderRecords (
23+ \Mockery::mock (Iterator::class),
24+ $ resource = \Mockery::mock (AsyncResource::class)
25+ );
26+
27+ self ::assertSame ($ resource , $ records ->getResource ());
28+ }
29+ }
Original file line number Diff line number Diff line change 88use ScriptFUSION \Porter \Collection \RecordCollection ;
99use ScriptFUSION \Porter \Specification \ImportSpecification ;
1010
11+ /**
12+ * @see PorterRecords
13+ */
1114final class PorterRecordsTest extends TestCase
1215{
13- public function test (): void
16+ /**
17+ * Tests that the specification passed at construction time is the same as that retrieved from the accessor method.
18+ */
19+ public function testGetSpecification (): void
1420 {
1521 $ records = new PorterRecords (
1622 \Mockery::mock (RecordCollection::class),
Original file line number Diff line number Diff line change 77use ScriptFUSION \Porter \Collection \ProviderRecords ;
88use ScriptFUSION \Porter \Provider \Resource \ProviderResource ;
99
10+ /**
11+ * @see ProviderRecords
12+ */
1013final class ProviderRecordsTest extends TestCase
1114{
12- public function test (): void
15+ /**
16+ * Tests that the resource passed at construction time is the same as that retrieved from the accessor method.
17+ */
18+ public function testGetResource (): void
1319 {
1420 $ records = new ProviderRecords (
1521 \Mockery::mock (\Iterator::class),
You can’t perform that action at this time.
0 commit comments