-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[DoctrineBridge] Fix LockStoreSchemaListener not working properly with iterable objects #54407
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
d6b4d84
adeae5a
a2d215a
e8c0279
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,6 @@ | |
use Doctrine\ORM\Tools\Event\GenerateSchemaEventArgs; | ||
use PHPUnit\Framework\TestCase; | ||
use Symfony\Bridge\Doctrine\SchemaListener\LockStoreSchemaListener; | ||
use Symfony\Component\Lock\Exception\InvalidArgumentException; | ||
use Symfony\Component\Lock\Store\DoctrineDbalStore; | ||
|
||
class LockStoreSchemaListenerTest extends TestCase | ||
|
@@ -40,20 +39,4 @@ public function testPostGenerateSchemaLockPdo() | |
$subscriber = new LockStoreSchemaListener([$lockStore]); | ||
$subscriber->postGenerateSchema($event); | ||
} | ||
|
||
public function testPostGenerateSchemaWithInvalidLockStore() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this test should be kept as fixing the issue #50761 tried to fix is legitimate |
||
{ | ||
$entityManager = $this->createMock(EntityManagerInterface::class); | ||
$entityManager->expects($this->once()) | ||
->method('getConnection') | ||
->willReturn($this->createMock(Connection::class)); | ||
$event = new GenerateSchemaEventArgs($entityManager, new Schema()); | ||
|
||
$subscriber = new LockStoreSchemaListener((static function (): \Generator { | ||
yield $this->createMock(DoctrineDbalStore::class); | ||
|
||
throw new InvalidArgumentException('Unsupported Connection'); | ||
})()); | ||
$subscriber->postGenerateSchema($event); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\Lock\Store; | ||
|
||
use Symfony\Component\Lock\BlockingSharedLockStoreInterface; | ||
use Symfony\Component\Lock\Key; | ||
|
||
/** | ||
* NullStore is a PersistingStoreInterface implementation which discards all operations. | ||
* | ||
* @author Pavel Bartoň <[email protected]> | ||
*/ | ||
class NullStore implements BlockingSharedLockStoreInterface | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Introducing this class (as well as the changes to the |
||
{ | ||
public function save(Key $key): void | ||
{ | ||
} | ||
|
||
public function saveRead(Key $key): void | ||
{ | ||
} | ||
|
||
public function waitAndSaveRead(Key $key): void | ||
{ | ||
} | ||
|
||
public function delete(Key $key): void | ||
{ | ||
} | ||
|
||
public function exists(Key $key): bool | ||
{ | ||
return false; | ||
} | ||
|
||
public function putOffExpiration(Key $key, float $ttl): void | ||
{ | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we still need catch the exception to not reintroduce the bug that #50761 tried to fix