Skip to content

Commit 6338dd5

Browse files
committed
Added ImportConnector::getWrappedConnector method so resources can configure connector.
1 parent 0a80812 commit 6338dd5

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

src/Connector/ImportConnector.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,14 @@ public function fetch($source)
2929
{
3030
return $this->connector->fetch($this->context, $source);
3131
}
32+
33+
/**
34+
* Gets the wrapped connector. Useful for resources to reconfigure connector options during this import.
35+
*
36+
* @return Connector
37+
*/
38+
public function getWrappedConnector()
39+
{
40+
return $this->connector;
41+
}
3242
}

test/Unit/Porter/Connector/ImportConnectorTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,17 @@ public function testFetchCacheEnabledButNotAvailable()
7676
FixtureFactory::buildConnectionContext(true)
7777
);
7878
}
79+
80+
/**
81+
* Tests that getting the wrapped connector returns exactly the same connector as constructed with.
82+
*/
83+
public function testGetWrappedConnector()
84+
{
85+
$connector = new ImportConnector(
86+
$wrappedConnector = \Mockery::mock(Connector::class),
87+
FixtureFactory::buildConnectionContext()
88+
);
89+
90+
self::assertSame($wrappedConnector, $connector->getWrappedConnector());
91+
}
7992
}

0 commit comments

Comments
 (0)