Skip to content

Commit f66687a

Browse files
committed
Updated Throttle interface parity.
1 parent 9d436ca commit f66687a

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

src/Connector/ImportConnector.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public function fetchAsync(AsyncDataSource $source): mixed
9393
{
9494
return retry(
9595
$this->maxFetchAttempts,
96-
fn () => $this->throttle->watch($this->connector->fetchAsync(...), $source),
96+
fn () => $this->throttle->async($this->connector->fetchAsync(...), $source),
9797
$this->createExceptionHandler()
9898
);
9999
}

test/Functional/ThrottlePrecedenceHierarchyTest.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ protected function setUp(): void
5454
public function testNonThrottledConnector(): void
5555
{
5656
$this->specification->setThrottle($this->specificationThrottle);
57-
$this->specificationThrottle->expects('watch')->once()->andReturn(Future::complete());
58-
$this->connectorThrottle->expects('watch')->never();
57+
$this->specificationThrottle->expects('async')->once()->andReturn(Future::complete());
58+
$this->connectorThrottle->expects('async')->never();
5959

6060
$connector = ImportConnectorFactory::create(
6161
$this->provider,
@@ -72,8 +72,8 @@ public function testNonThrottledConnector(): void
7272
*/
7373
public function testThrottledConnector(): void
7474
{
75-
$this->specificationThrottle->expects('watch')->never();
76-
$this->connectorThrottle->expects('watch')->once()->andReturn(Future::complete());
75+
$this->specificationThrottle->expects('async')->never();
76+
$this->connectorThrottle->expects('async')->once()->andReturn(Future::complete());
7777

7878
$connector = ImportConnectorFactory::create(
7979
$this->provider,
@@ -91,8 +91,8 @@ public function testThrottledConnector(): void
9191
public function testThrottledConnectorOverride(): void
9292
{
9393
$this->specification->setThrottle($this->specificationThrottle);
94-
$this->specificationThrottle->expects('watch')->once()->andReturn(Future::complete());
95-
$this->connectorThrottle->expects('watch')->never();
94+
$this->specificationThrottle->expects('async')->once()->andReturn(Future::complete());
95+
$this->connectorThrottle->expects('async')->never();
9696

9797
$connector = ImportConnectorFactory::create(
9898
$this->provider,

test/Integration/Connector/ImportConnectorTest.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public function testAsyncUserRecoverableExceptionHandler(): void
119119
try {
120120
$connector->fetchAsync($this->asyncSource);
121121
} catch (\Exception $e) {
122-
self::assertSame($exception, $e);
122+
self::assertSame($exception, $e, $e->getMessage());
123123
}
124124
}
125125

@@ -143,7 +143,7 @@ public function testAsyncResourceRecoverableExceptionHandler(): void
143143
try {
144144
$connector->fetchAsync($this->asyncSource);
145145
} catch (\Exception $e) {
146-
self::assertSame($exception, $e);
146+
self::assertSame($exception, $e, $e->getMessage());
147147
}
148148
}
149149

@@ -168,13 +168,13 @@ public function testAsyncUserAndResourceRecoverableExceptionHandlers(): void
168168
try {
169169
$connector->fetchAsync($this->asyncSource);
170170
} catch (\Exception $exception) {
171-
self::assertSame($e1, $exception);
171+
self::assertSame($e1, $exception, $exception->getMessage());
172172
}
173173

174174
try {
175175
$connector->fetchAsync($this->asyncSource);
176176
} catch (\Exception $exception) {
177-
self::assertSame($e2, $exception);
177+
self::assertSame($e2, $exception, $exception->getMessage());
178178
}
179179
}
180180

test/MockFactory.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public static function mockSingleRecordResource(Provider $provider): ProviderRes
9191
public static function mockThrottle(): Throttle|MockInterface
9292
{
9393
return \Mockery::mock(Throttle::class)
94-
->allows('watch')
94+
->allows('async')
9595
->andReturnUsing(fn (\Closure $closure, mixed ...$args) => async($closure, ...$args))
9696
->byDefault()
9797
->getMock()

0 commit comments

Comments
 (0)