Skip to content

Commit 8e70e7b

Browse files
committed
Killed all outstanding mutants.
1 parent f8fa351 commit 8e70e7b

File tree

3 files changed

+40
-0
lines changed

3 files changed

+40
-0
lines changed

test/Integration/PorterAsyncTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@
88
use Amp\Producer;
99
use Amp\Promise;
1010
use ScriptFUSION\Async\Throttle\DualThrottle;
11+
use ScriptFUSION\Porter\Collection\AsyncPorterRecords;
1112
use ScriptFUSION\Porter\Collection\AsyncRecordCollection;
1213
use ScriptFUSION\Porter\Collection\CountableAsyncPorterRecords;
1314
use ScriptFUSION\Porter\Collection\CountableAsyncProviderRecords;
15+
use ScriptFUSION\Porter\Collection\PorterRecords;
1416
use ScriptFUSION\Porter\ForeignResourceException;
1517
use ScriptFUSION\Porter\ImportException;
1618
use ScriptFUSION\Porter\IncompatibleProviderException;
@@ -46,6 +48,8 @@ public function testImportAsync(): \Generator
4648
{
4749
$records = $this->porter->importAsync($this->specification);
4850

51+
self::assertInstanceOf(AsyncPorterRecords::class, $records);
52+
self::assertNotSame($this->specification, $records->getSpecification(), 'Specification was not cloned.');
4953
self::assertTrue(yield $records->advance());
5054
self::assertSame(['foo'], $records->getCurrent());
5155
}

test/Integration/PorterSyncTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,20 @@ public function testImportSingle(): void
195195
$this->porter->import($this->singleSpecification);
196196
}
197197

198+
/**
199+
* Tests that when a resource returns ProviderRecords, Porter does not wrap the collection again.
200+
*/
201+
public function testProviderRecordsNotDoubleWrapped(): void
202+
{
203+
$this->resource->shouldReceive('fetch')
204+
->andReturn($records = new ProviderRecords(new \ArrayIterator([]), $this->resource));
205+
206+
$imported = $this->porter->import($this->specification);
207+
208+
self::assertInstanceOf(PorterRecords::class, $imported);
209+
self::assertSame($records, $imported->getPreviousCollection());
210+
}
211+
198212
#endregion
199213

200214
#region Import one
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
declare(strict_types=1);
3+
4+
namespace ScriptFUSIONTest\Unit\Provider\Resource;
5+
6+
use ScriptFUSION\Porter\IncompatibleResourceException;
7+
use PHPUnit\Framework\TestCase;
8+
use ScriptFUSION\Porter\Provider\Resource\SingleRecordResource;
9+
10+
/**
11+
* @see IncompatibleResourceException
12+
*/
13+
final class IncompatibleResourceExceptionTest extends TestCase
14+
{
15+
public function testCreateMustImplementInterface(): void
16+
{
17+
self::assertMatchesRegularExpression(
18+
sprintf('[.%s\\.]', addslashes(SingleRecordResource::class)),
19+
IncompatibleResourceException::createMustImplementInterface()->getMessage()
20+
);
21+
}
22+
}

0 commit comments

Comments
 (0)