Skip to content

Commit

Permalink
[DoctrineClearIdentityMapExtension] allow instances of ManagerRegistry
Browse files Browse the repository at this point in the history
We only use the method `getManagers()` which comes from this interface, and not the RegistryInterface from Sf's doctrine bridge. So it makes sense to allow passing implementations of parent interfaces.

This will also allow us to use this class with Doctrine ODM.
  • Loading branch information
Lctrs committed Aug 5, 2019
1 parent a73e48b commit 64cdba0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@

namespace Enqueue\Bundle\Consumption\Extension;

use Doctrine\Common\Persistence\ManagerRegistry;
use Enqueue\Consumption\Context\MessageReceived;
use Enqueue\Consumption\MessageReceivedExtensionInterface;
use Symfony\Bridge\Doctrine\RegistryInterface;

class DoctrineClearIdentityMapExtension implements MessageReceivedExtensionInterface
{
/**
* @var RegistryInterface
* @var ManagerRegistry
*/
protected $registry;

/**
* @param RegistryInterface $registry
* @param ManagerRegistry $registry
*/
public function __construct(RegistryInterface $registry)
public function __construct(ManagerRegistry $registry)
{
$this->registry = $registry;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Enqueue\Bundle\Tests\Unit\Consumption\Extension;

use Doctrine\Common\Persistence\ManagerRegistry;
use Doctrine\Common\Persistence\ObjectManager;
use Enqueue\Bundle\Consumption\Extension\DoctrineClearIdentityMapExtension;
use Enqueue\Consumption\Context\MessageReceived;
Expand All @@ -11,7 +12,6 @@
use Interop\Queue\Processor;
use PHPUnit\Framework\TestCase;
use Psr\Log\LoggerInterface;
use Symfony\Bridge\Doctrine\RegistryInterface;

class DoctrineClearIdentityMapExtensionTest extends TestCase
{
Expand Down Expand Up @@ -59,11 +59,11 @@ protected function createContext(): MessageReceived
}

/**
* @return \PHPUnit_Framework_MockObject_MockObject|RegistryInterface
* @return \PHPUnit_Framework_MockObject_MockObject|ManagerRegistry
*/
protected function createRegistryMock(): RegistryInterface
protected function createRegistryMock(): ManagerRegistry
{
return $this->createMock(RegistryInterface::class);
return $this->createMock(ManagerRegistry::class);
}

/**
Expand Down

0 comments on commit 64cdba0

Please sign in to comment.