Skip to content

Commit fe50a38

Browse files
committed
Added unit test for ImportConnector::getProvider().
1 parent 749f410 commit fe50a38

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

test/FixtureFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ final class FixtureFactory
1717
public static function buildImportConnector(
1818
Connector $connector,
1919
RecoverableExceptionHandler $recoverableExceptionHandler = null,
20+
Provider $provider = null,
2021
int $maxFetchAttempts = ImportSpecification::DEFAULT_FETCH_ATTEMPTS,
21-
bool $mustCache = false,
22-
Provider $provider = null
22+
bool $mustCache = false
2323
): ImportConnector {
2424
return new ImportConnector(
2525
$provider ?? \Mockery::mock(Provider::class),

test/Functional/ThrottlePrecedenceHierarchyTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,11 @@ final class ThrottlePrecedenceHierarchyTest extends AsyncTestCase
2525
use MockeryPHPUnitIntegration;
2626

2727
private $specificationThrottle;
28+
2829
private $connectorThrottle;
30+
2931
private $specification;
32+
3033
private $provider;
3134

3235
protected function setUp(): void

test/Unit/Connector/ImportConnectorTest.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use ScriptFUSION\Porter\Connector\DataSource;
1414
use ScriptFUSION\Porter\Connector\ImportConnector;
1515
use ScriptFUSION\Porter\Connector\Recoverable\RecoverableExceptionHandler;
16+
use ScriptFUSION\Porter\Provider\Provider;
1617
use ScriptFUSIONTest\FixtureFactory;
1718

1819
/**
@@ -74,6 +75,7 @@ public function testFetchCacheEnabled(): void
7475
->andReturn($output = 'foo')
7576
->getMock(),
7677
null,
78+
null,
7779
1,
7880
true
7981
);
@@ -108,7 +110,7 @@ public function testFetchCacheEnabledButNotAvailable(): void
108110
{
109111
$this->expectException(CacheUnavailableException::class);
110112

111-
FixtureFactory::buildImportConnector(\Mockery::mock(Connector::class), null, 1, true);
113+
FixtureFactory::buildImportConnector(\Mockery::mock(Connector::class), null, null, 1, true);
112114
}
113115

114116
/**
@@ -151,4 +153,18 @@ public function testFindBaseConnector(): void
151153

152154
self::assertSame($baseConnector, $connector->findBaseConnector());
153155
}
156+
157+
/**
158+
* Tests that the provider passed to the constructor can be retrieved via a getter.
159+
*/
160+
public function testGetProvider(): void
161+
{
162+
$connector = FixtureFactory::buildImportConnector(
163+
\Mockery::mock(Connector::class),
164+
null,
165+
$provider = \Mockery::mock(Provider::class)
166+
);
167+
168+
self::assertSame($provider, $connector->getProvider());
169+
}
154170
}

0 commit comments

Comments
 (0)