mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-05 20:57:12 +00:00
Make test mocks compatible with DBAL 3 and 4
(cherry picked from commit e264fac021)
This commit is contained in:
parent
bd364048bb
commit
c976028ee7
2 changed files with 4 additions and 34 deletions
|
|
@ -13,25 +13,14 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Tests\Functional\Doctrine\Mock;
|
||||
|
||||
use Doctrine\Common\EventManager;
|
||||
use Doctrine\DBAL\Configuration;
|
||||
use Doctrine\DBAL\Connection;
|
||||
use Doctrine\DBAL\Driver;
|
||||
|
||||
class ConnectionMock extends Connection
|
||||
{
|
||||
/** @var DatabasePlatformMock */
|
||||
private $_platformMock;
|
||||
|
||||
public function __construct(array $params = [], ?Driver $driver = null, ?Configuration $config = null, ?EventManager $eventManager = null)
|
||||
public function __construct(array $params = [], ?Driver $driver = null, ?Configuration $config = null)
|
||||
{
|
||||
$this->_platformMock = new DatabasePlatformMock();
|
||||
|
||||
parent::__construct($params, $driver ?? new DriverMock(), $config, $eventManager);
|
||||
}
|
||||
|
||||
public function getDatabasePlatform()
|
||||
{
|
||||
return $this->_platformMock;
|
||||
parent::__construct($params, $driver ?? new DriverMock(), $config);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,32 +13,13 @@ declare(strict_types=1);
|
|||
|
||||
namespace Sylius\Tests\Functional\Doctrine\Mock;
|
||||
|
||||
use Doctrine\DBAL\Connection;
|
||||
use Doctrine\DBAL\Driver;
|
||||
use Doctrine\DBAL\Driver\API\ExceptionConverter;
|
||||
use Doctrine\DBAL\Driver\AbstractSQLiteDriver;
|
||||
use Doctrine\DBAL\Driver\Connection as DriverConnection;
|
||||
use Doctrine\DBAL\Platforms\AbstractPlatform;
|
||||
use Doctrine\DBAL\Schema\AbstractSchemaManager;
|
||||
|
||||
class DriverMock implements Driver
|
||||
class DriverMock extends AbstractSQLiteDriver
|
||||
{
|
||||
public function connect(array $params): DriverConnection
|
||||
{
|
||||
return new DriverConnectionMock();
|
||||
}
|
||||
|
||||
public function getDatabasePlatform(): AbstractPlatform
|
||||
{
|
||||
throw new \BadMethodCallException('Not implemented');
|
||||
}
|
||||
|
||||
public function getSchemaManager(Connection $conn, ?AbstractPlatform $platform = null): AbstractSchemaManager
|
||||
{
|
||||
throw new \BadMethodCallException('Not implemented');
|
||||
}
|
||||
|
||||
public function getExceptionConverter(): ExceptionConverter
|
||||
{
|
||||
throw new \BadMethodCallException('Not implemented');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue