Skip to content

Commit

Permalink
Merge branch '5.4' into 6.4
Browse files Browse the repository at this point in the history
* 5.4:
  fix XSD to allow to configure locks without resources
  • Loading branch information
xabbuh committed Sep 17, 2024
2 parents 40aa18d + d022058 commit 5432bc4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Resources/config/schema/symfony-1.0.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@

<xsd:complexType name="lock">
<xsd:sequence>
<xsd:element name="resource" type="lock_resource" minOccurs="1" maxOccurs="unbounded" />
<xsd:element name="resource" type="lock_resource" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
<xsd:attribute name="enabled" type="xsd:boolean" />
</xsd:complexType>
Expand Down
8 changes: 7 additions & 1 deletion Tests/DependencyInjection/FrameworkExtensionTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
use Symfony\Component\HttpClient\ScopingHttpClient;
use Symfony\Component\HttpKernel\DependencyInjection\LoggerPass;
use Symfony\Component\HttpKernel\Fragment\FragmentUriGeneratorInterface;
use Symfony\Component\Lock\Store\SemaphoreStore;
use Symfony\Component\Messenger\Bridge\AmazonSqs\Transport\AmazonSqsTransportFactory;
use Symfony\Component\Messenger\Bridge\Amqp\Transport\AmqpTransportFactory;
use Symfony\Component\Messenger\Bridge\Beanstalkd\Transport\BeanstalkdTransportFactory;
Expand Down Expand Up @@ -2402,7 +2403,12 @@ public function testDefaultLock()

self::assertTrue($container->hasDefinition('lock.default.factory'));
$storeDef = $container->getDefinition($container->getDefinition('lock.default.factory')->getArgument(0));
self::assertEquals(new Reference('semaphore'), $storeDef->getArgument(0));

if (class_exists(SemaphoreStore::class) && SemaphoreStore::isSupported()) {
self::assertEquals(new Reference('semaphore'), $storeDef->getArgument(0));
} else {
self::assertEquals(new Reference('flock'), $storeDef->getArgument(0));
}
}

public function testNamedLocks()
Expand Down

0 comments on commit 5432bc4

Please sign in to comment.