Make test mocks compatible with DBAL 3 and 4

(cherry picked from commit e264fac021)
This commit is contained in:
TheMilek 2026-02-09 14:34:03 +01:00 committed by Grzegorz Sadowski
parent bd364048bb
commit c976028ee7
No known key found for this signature in database
GPG key ID: EF87FF4E6E3BD364
2 changed files with 4 additions and 34 deletions

View file

@ -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);
}
}

View file

@ -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');
}
}