@@ -188,7 +188,7 @@ public function testWorkflowDefaultMarkingStoreDefinition()
188188 $ this ->assertNull ($ argumentsB ['index_1 ' ], 'workflow_b marking_store argument is null ' );
189189 }
190190
191- public function testRateLimiterWithLockFactory ()
191+ public function testRateLimiterLockFactoryWithLockDisabled ()
192192 {
193193 try {
194194 $ this ->createContainerFromClosure (function (ContainerBuilder $ container ) {
@@ -199,7 +199,7 @@ public function testRateLimiterWithLockFactory()
199199 'php_errors ' => ['log ' => true ],
200200 'lock ' => false ,
201201 'rate_limiter ' => [
202- 'with_lock ' => ['policy ' => 'fixed_window ' , 'limit ' => 10 , 'interval ' => '1 hour ' ],
202+ 'with_lock ' => ['policy ' => 'fixed_window ' , 'limit ' => 10 , 'interval ' => '1 hour ' , ' lock_factory ' => ' lock.factory ' ],
203203 ],
204204 ]);
205205 });
@@ -208,7 +208,10 @@ public function testRateLimiterWithLockFactory()
208208 } catch (LogicException $ e ) {
209209 $ this ->assertEquals ('Rate limiter "with_lock" requires the Lock component to be configured. ' , $ e ->getMessage ());
210210 }
211+ }
211212
213+ public function testRateLimiterAutoLockFactoryWithLockEnabled ()
214+ {
212215 $ container = $ this ->createContainerFromClosure (function (ContainerBuilder $ container ) {
213216 $ container ->loadFromExtension ('framework ' , [
214217 'annotations ' => false ,
@@ -226,13 +229,35 @@ public function testRateLimiterWithLockFactory()
226229 $ this ->assertEquals ('lock.factory ' , (string ) $ withLock ->getArgument (2 ));
227230 }
228231
229- public function testRateLimiterLockFactory ()
232+ public function testRateLimiterAutoLockFactoryWithLockDisabled ()
230233 {
231234 $ container = $ this ->createContainerFromClosure (function (ContainerBuilder $ container ) {
232235 $ container ->loadFromExtension ('framework ' , [
233236 'annotations ' => false ,
234237 'http_method_override ' => false ,
235238 'handle_all_throwables ' => true ,
239+ 'lock ' => false ,
240+ 'php_errors ' => ['log ' => true ],
241+ 'rate_limiter ' => [
242+ 'without_lock ' => ['policy ' => 'fixed_window ' , 'limit ' => 10 , 'interval ' => '1 hour ' ],
243+ ],
244+ ]);
245+ });
246+
247+ $ this ->expectException (OutOfBoundsException::class);
248+ $ this ->expectExceptionMessageMatches ('/^The argument "2" doesn \'t exist.*\.$/ ' );
249+
250+ $ container ->getDefinition ('limiter.without_lock ' )->getArgument (2 );
251+ }
252+
253+ public function testRateLimiterDisableLockFactory ()
254+ {
255+ $ container = $ this ->createContainerFromClosure (function (ContainerBuilder $ container ) {
256+ $ container ->loadFromExtension ('framework ' , [
257+ 'annotations ' => false ,
258+ 'http_method_override ' => false ,
259+ 'handle_all_throwables ' => true ,
260+ 'lock ' => true ,
236261 'php_errors ' => ['log ' => true ],
237262 'rate_limiter ' => [
238263 'without_lock ' => ['policy ' => 'fixed_window ' , 'limit ' => 10 , 'interval ' => '1 hour ' , 'lock_factory ' => null ],
0 commit comments