Skip to content

Commit d2ad56c

Browse files
alli83nicolas-grekas
authored andcommitted
[Lock] fix: add lock schema listener test + fix typo
1 parent dcee72b commit d2ad56c

File tree

5 files changed

+50
-7
lines changed

5 files changed

+50
-7
lines changed

SchemaListener/DoctrineDbalCacheAdapterSchemaSubscriber.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
use Doctrine\Common\EventSubscriber;
1515
use Doctrine\ORM\Tools\ToolEvents;
16-
use Symfony\Component\Cache\Adapter\DoctrineDbalAdapter;
1716

1817
trigger_deprecation('symfony/doctrine-bridge', '6.3', 'The "%s" class is deprecated. Use "%s" instead.', DoctrineDbalCacheAdapterSchemaSubscriber::class, DoctrineDbalCacheAdapterSchemaListener::class);
1918

Tests/SchemaListener/DoctrineDbalCacheAdapterSchemaSubscriberTest.php renamed to Tests/SchemaListener/DoctrineDbalCacheAdapterSchemaListenerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
use Symfony\Bridge\Doctrine\SchemaListener\DoctrineDbalCacheAdapterSchemaListener;
2020
use Symfony\Component\Cache\Adapter\DoctrineDbalAdapter;
2121

22-
class DoctrineDbalCacheAdapterSchemaSubscriberTest extends TestCase
22+
class DoctrineDbalCacheAdapterSchemaListenerTest extends TestCase
2323
{
2424
public function testPostGenerateSchema()
2525
{
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Bridge\Doctrine\Tests\SchemaListener;
13+
14+
use Doctrine\DBAL\Connection;
15+
use Doctrine\DBAL\Schema\Schema;
16+
use Doctrine\ORM\EntityManagerInterface;
17+
use Doctrine\ORM\Tools\Event\GenerateSchemaEventArgs;
18+
use PHPUnit\Framework\TestCase;
19+
use Symfony\Bridge\Doctrine\SchemaListener\LockStoreSchemaListener;
20+
use Symfony\Component\Lock\Store\DoctrineDbalStore;
21+
22+
class LockStoreSchemaListenerTest extends TestCase
23+
{
24+
public function testPostGenerateSchemaLockPdo()
25+
{
26+
$schema = new Schema();
27+
$dbalConnection = $this->createMock(Connection::class);
28+
$entityManager = $this->createMock(EntityManagerInterface::class);
29+
$entityManager->expects($this->once())
30+
->method('getConnection')
31+
->willReturn($dbalConnection);
32+
$event = new GenerateSchemaEventArgs($entityManager, $schema);
33+
34+
$lockStore = $this->createMock(DoctrineDbalStore::class);
35+
$lockStore->expects($this->once())
36+
->method('configureSchema')
37+
->with($schema, fn () => true);
38+
39+
$subscriber = new LockStoreSchemaListener([$lockStore]);
40+
$subscriber->postGenerateSchema($event);
41+
}
42+
}

Tests/SchemaListener/MessengerTransportDoctrineSchemaSubscriberTest.php renamed to Tests/SchemaListener/MessengerTransportDoctrineSchemaListenerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
use Symfony\Component\Messenger\Bridge\Doctrine\Transport\DoctrineTransport;
2424
use Symfony\Component\Messenger\Transport\TransportInterface;
2525

26-
class MessengerTransportDoctrineSchemaSubscriberTest extends TestCase
26+
class MessengerTransportDoctrineSchemaListenerTest extends TestCase
2727
{
2828
public function testPostGenerateSchema()
2929
{

composer.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,23 @@
2525
"symfony/service-contracts": "^2.5|^3"
2626
},
2727
"require-dev": {
28-
"symfony/stopwatch": "^5.4|^6.0",
2928
"symfony/cache": "^5.4|^6.0",
3029
"symfony/config": "^5.4|^6.0",
3130
"symfony/dependency-injection": "^6.2",
31+
"symfony/doctrine-messenger": "^5.4|^6.0",
32+
"symfony/expression-language": "^5.4|^6.0",
3233
"symfony/form": "^5.4.21|^6.2.7",
3334
"symfony/http-kernel": "^6.3",
35+
"symfony/lock": "^6.3",
3436
"symfony/messenger": "^5.4|^6.0",
35-
"symfony/doctrine-messenger": "^5.4|^6.0",
3637
"symfony/property-access": "^5.4|^6.0",
3738
"symfony/property-info": "^5.4|^6.0",
3839
"symfony/proxy-manager-bridge": "^5.4|^6.0",
3940
"symfony/security-core": "^6.0",
40-
"symfony/expression-language": "^5.4|^6.0",
41+
"symfony/stopwatch": "^5.4|^6.0",
42+
"symfony/translation": "^5.4|^6.0",
4143
"symfony/uid": "^5.4|^6.0",
4244
"symfony/validator": "^5.4|^6.0",
43-
"symfony/translation": "^5.4|^6.0",
4445
"symfony/var-dumper": "^5.4|^6.0",
4546
"doctrine/annotations": "^1.13.1|^2",
4647
"doctrine/collections": "^1.0|^2.0",
@@ -60,6 +61,7 @@
6061
"symfony/form": "<5.4.21|>=6,<6.2.7",
6162
"symfony/http-foundation": "<6.3",
6263
"symfony/http-kernel": "<6.2",
64+
"symfony/lock": "<6.3",
6365
"symfony/messenger": "<5.4",
6466
"symfony/property-info": "<5.4",
6567
"symfony/security-bundle": "<5.4",

0 commit comments

Comments
 (0)