File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change 44namespace ScriptFUSIONTest \Unit ;
55
66use PHPUnit \Framework \TestCase ;
7+ use ScriptFUSION \Async \Throttle \Throttle ;
78use ScriptFUSION \Porter \Connector \Recoverable \ExponentialAsyncDelayRecoverableExceptionHandler ;
89use ScriptFUSION \Porter \Connector \Recoverable \RecoverableExceptionHandler ;
910use 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}
You can’t perform that action at this time.
0 commit comments