Skip to content

Commit 6f294bd

Browse files
committed
Added unit tests for AsyncImportSpecification::getThrottle().
1 parent f5f753c commit 6f294bd

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

test/Unit/AsyncImportSpecificationTest.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
namespace ScriptFUSIONTest\Unit;
55

66
use PHPUnit\Framework\TestCase;
7+
use ScriptFUSION\Async\Throttle\Throttle;
78
use ScriptFUSION\Porter\Connector\Recoverable\ExponentialAsyncDelayRecoverableExceptionHandler;
89
use ScriptFUSION\Porter\Connector\Recoverable\RecoverableExceptionHandler;
910
use ScriptFUSION\Porter\Provider\Resource\AsyncResource;
@@ -77,4 +78,23 @@ public function testClone(): void
7778
self::assertNotSame($context, $specification->getContext());
7879
self::assertNotSame($handler, $specification->getRecoverableExceptionHandler());
7980
}
81+
82+
/**
83+
* Tests that a custom throttle can be set.
84+
*/
85+
public function testThrottle(): void
86+
{
87+
self::assertSame(
88+
$throttle = \Mockery::mock(Throttle::class),
89+
$this->specification->setThrottle($throttle)->getThrottle()
90+
);
91+
}
92+
93+
/**
94+
* Tests that when no throttle is set, a default throttle is produced.
95+
*/
96+
public function testDefaultThrottle(): void
97+
{
98+
self::assertInstanceOf(Throttle::class, $this->specification->getThrottle());
99+
}
80100
}

0 commit comments

Comments
 (0)