8000 bug #49674 [FrameworkBundle] Rename limiter’s `strategy` to `policy` … · symfony/symfony@2721aba · GitHub
[go: up one dir, main page]

Skip to content

Commit 2721aba

Browse files
committed
bug #49674 [FrameworkBundle] Rename limiter’s strategy to policy in XSD (MatTheCat)
This PR was merged into the 5.4 branch. Discussion ---------- [FrameworkBundle] Rename limiter’s `strategy` to `policy` in XSD | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #49671 | License | MIT | Doc PR | N/A #38664 renamed `strategy` to `policy` but did not update the XSD. Commits ------- c19711c [FrameworkBundle] Rename limiter’s `strategy` to `policy` in XSD
2 parents e1b1b7d + c19711c commit 2721aba

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,7 @@
748748
<xsd:attribute name="lock-factory" type="xsd:string" />
749749
<xsd:attribute name="storage-service" type="xsd:string" />
750750
<xsd:attribute name="cache-pool" type="xsd:string" />
751-
<xsd:attribute name="strategy" type="xsd:string" />
751+
<xsd:attribute name="policy" type="xsd:string" />
752752
<xsd:attribute name="limit" type="xsd:int" />
753753
<xsd:attribute name="interval" type="xsd:string" />
754754
</xsd:complexType>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" ?>
2+
3+
<container xmlns="http://symfony.com/schema/dic/services"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xmlns:framework="http://symfony.com/schema/dic/symfony"
6+
xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd
7+
http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
8+
9+
<framework:config>
10+
<framework:rate-limiter>
11+
<framework:limiter
12+
name="sliding_window"
13+
policy="sliding_window"
14+
limit="30"
15+
lock-factory="null"
16+
/>
17+
</framework:rate-limiter>
18+
</framework:config>
19+
</container>

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/XmlFrameworkExtensionTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Symfony\Component\Config\FileLocator;
1515
use Symfony\Component\DependencyInjection\ContainerBuilder;
1616
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
17+
use Symfony\Component\RateLimiter\Policy\SlidingWindowLimiter;
1718

1819
class XmlFrameworkExtensionTest extends FrameworkExtensionTestCase
1920
{
@@ -66,4 +67,11 @@ public function testLegacyExceptionsConfig()
6667
'status_code' => 500,
6768
], $configuration[\Symfony\Component\HttpKernel\Exception\ServiceUnavailableHttpException::class]);
6869
}
70+
71+
public function testRateLimiter()
72+
{
73+
$container = $this->createContainerFromFile('rate_limiter');
74+
75+
$this->assertTrue($container->hasDefinition('limiter.sliding_window'));
76+
}
6977
}

0 commit comments

Comments
 (0)
0