Unverified Commit 133ce49c authored by Sergei Morozov's avatar Sergei Morozov Committed by GitHub

Merge pull request #3903 from morozov/phpunit-9.0

Upgrade PHPUnit to 9.0
parents ad96d888 a44d34e3
# Upgrade to 3.0 # Upgrade to 3.0
## BC BREAK: PingableConnection and ServerInfoAwareConnection interfaces now extend Connection
All implementations of the `PingableConnection` and `ServerInfoAwareConnection` interfaces have to implement the methods defined in the `Connection` interface as well.
## BC BREAK: VersionAwarePlatformDriver interface now extends Driver
All implementations of the `VersionAwarePlatformDriver` interface have to implement the methods defined in the `Driver` interface as well.
## BC BREAK: Removed Doctrine\DBAL\Version ## BC BREAK: Removed Doctrine\DBAL\Version
The `Doctrine\DBAL\Version` class is no longer available: please refrain from checking the DBAL version at runtime. The `Doctrine\DBAL\Version` class is no longer available: please refrain from checking the DBAL version at runtime.
......
This diff is collapsed.
...@@ -4,7 +4,6 @@ namespace Doctrine\DBAL\Driver; ...@@ -4,7 +4,6 @@ namespace Doctrine\DBAL\Driver;
use Doctrine\DBAL\Connection; use Doctrine\DBAL\Connection;
use Doctrine\DBAL\DBALException; use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Driver;
use Doctrine\DBAL\Exception; use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Platforms\MariaDb1027Platform; use Doctrine\DBAL\Platforms\MariaDb1027Platform;
use Doctrine\DBAL\Platforms\MySQL57Platform; use Doctrine\DBAL\Platforms\MySQL57Platform;
...@@ -19,7 +18,7 @@ use function version_compare; ...@@ -19,7 +18,7 @@ use function version_compare;
/** /**
* Abstract base implementation of the {@link Doctrine\DBAL\Driver} interface for MySQL based drivers. * Abstract base implementation of the {@link Doctrine\DBAL\Driver} interface for MySQL based drivers.
*/ */
abstract class AbstractMySQLDriver implements Driver, ExceptionConverterDriver, VersionAwarePlatformDriver abstract class AbstractMySQLDriver implements ExceptionConverterDriver, VersionAwarePlatformDriver
{ {
/** /**
* {@inheritdoc} * {@inheritdoc}
......
...@@ -4,7 +4,6 @@ namespace Doctrine\DBAL\Driver; ...@@ -4,7 +4,6 @@ namespace Doctrine\DBAL\Driver;
use Doctrine\DBAL\Connection; use Doctrine\DBAL\Connection;
use Doctrine\DBAL\DBALException; use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Driver;
use Doctrine\DBAL\Exception; use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Platforms\PostgreSQL100Platform; use Doctrine\DBAL\Platforms\PostgreSQL100Platform;
use Doctrine\DBAL\Platforms\PostgreSQL91Platform; use Doctrine\DBAL\Platforms\PostgreSQL91Platform;
...@@ -20,7 +19,7 @@ use function version_compare; ...@@ -20,7 +19,7 @@ use function version_compare;
/** /**
* Abstract base implementation of the {@link Doctrine\DBAL\Driver} interface for PostgreSQL based drivers. * Abstract base implementation of the {@link Doctrine\DBAL\Driver} interface for PostgreSQL based drivers.
*/ */
abstract class AbstractPostgreSQLDriver implements Driver, ExceptionConverterDriver, VersionAwarePlatformDriver abstract class AbstractPostgreSQLDriver implements ExceptionConverterDriver, VersionAwarePlatformDriver
{ {
/** /**
* {@inheritdoc} * {@inheritdoc}
......
...@@ -4,7 +4,6 @@ namespace Doctrine\DBAL\Driver; ...@@ -4,7 +4,6 @@ namespace Doctrine\DBAL\Driver;
use Doctrine\DBAL\Connection; use Doctrine\DBAL\Connection;
use Doctrine\DBAL\DBALException; use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Driver;
use Doctrine\DBAL\Exception; use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Platforms\SQLAnywhere11Platform; use Doctrine\DBAL\Platforms\SQLAnywhere11Platform;
use Doctrine\DBAL\Platforms\SQLAnywhere12Platform; use Doctrine\DBAL\Platforms\SQLAnywhere12Platform;
...@@ -18,7 +17,7 @@ use function version_compare; ...@@ -18,7 +17,7 @@ use function version_compare;
/** /**
* Abstract base implementation of the {@link Doctrine\DBAL\Driver} interface for SAP Sybase SQL Anywhere based drivers. * Abstract base implementation of the {@link Doctrine\DBAL\Driver} interface for SAP Sybase SQL Anywhere based drivers.
*/ */
abstract class AbstractSQLAnywhereDriver implements Driver, ExceptionConverterDriver, VersionAwarePlatformDriver abstract class AbstractSQLAnywhereDriver implements ExceptionConverterDriver, VersionAwarePlatformDriver
{ {
/** /**
* {@inheritdoc} * {@inheritdoc}
......
...@@ -4,7 +4,6 @@ namespace Doctrine\DBAL\Driver; ...@@ -4,7 +4,6 @@ namespace Doctrine\DBAL\Driver;
use Doctrine\DBAL\Connection; use Doctrine\DBAL\Connection;
use Doctrine\DBAL\DBALException; use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Driver;
use Doctrine\DBAL\Platforms\SQLServer2005Platform; use Doctrine\DBAL\Platforms\SQLServer2005Platform;
use Doctrine\DBAL\Platforms\SQLServer2008Platform; use Doctrine\DBAL\Platforms\SQLServer2008Platform;
use Doctrine\DBAL\Platforms\SQLServer2012Platform; use Doctrine\DBAL\Platforms\SQLServer2012Platform;
...@@ -17,7 +16,7 @@ use function version_compare; ...@@ -17,7 +16,7 @@ use function version_compare;
/** /**
* Abstract base implementation of the {@link Doctrine\DBAL\Driver} interface for Microsoft SQL Server based drivers. * Abstract base implementation of the {@link Doctrine\DBAL\Driver} interface for Microsoft SQL Server based drivers.
*/ */
abstract class AbstractSQLServerDriver implements Driver, VersionAwarePlatformDriver abstract class AbstractSQLServerDriver implements VersionAwarePlatformDriver
{ {
/** /**
* {@inheritdoc} * {@inheritdoc}
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
namespace Doctrine\DBAL\Driver\IBMDB2; namespace Doctrine\DBAL\Driver\IBMDB2;
use Doctrine\DBAL\Driver\Connection;
use Doctrine\DBAL\Driver\ResultStatement; use Doctrine\DBAL\Driver\ResultStatement;
use Doctrine\DBAL\Driver\ServerInfoAwareConnection; use Doctrine\DBAL\Driver\ServerInfoAwareConnection;
use Doctrine\DBAL\Driver\Statement as DriverStatement; use Doctrine\DBAL\Driver\Statement as DriverStatement;
...@@ -25,7 +24,7 @@ use function db2_rollback; ...@@ -25,7 +24,7 @@ use function db2_rollback;
use function db2_server_info; use function db2_server_info;
use function db2_stmt_errormsg; use function db2_stmt_errormsg;
class DB2Connection implements Connection, ServerInfoAwareConnection class DB2Connection implements ServerInfoAwareConnection
{ {
/** @var resource */ /** @var resource */
private $conn = null; private $conn = null;
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
namespace Doctrine\DBAL\Driver\Mysqli; namespace Doctrine\DBAL\Driver\Mysqli;
use Doctrine\DBAL\Driver\Connection;
use Doctrine\DBAL\Driver\PingableConnection; use Doctrine\DBAL\Driver\PingableConnection;
use Doctrine\DBAL\Driver\ResultStatement; use Doctrine\DBAL\Driver\ResultStatement;
use Doctrine\DBAL\Driver\ServerInfoAwareConnection; use Doctrine\DBAL\Driver\ServerInfoAwareConnection;
...@@ -28,7 +27,7 @@ use function set_error_handler; ...@@ -28,7 +27,7 @@ use function set_error_handler;
use function sprintf; use function sprintf;
use function stripos; use function stripos;
class MysqliConnection implements Connection, PingableConnection, ServerInfoAwareConnection class MysqliConnection implements PingableConnection, ServerInfoAwareConnection
{ {
/** /**
* Name of the option to set connection flags * Name of the option to set connection flags
......
...@@ -11,7 +11,7 @@ use function assert; ...@@ -11,7 +11,7 @@ use function assert;
* *
* Used by all PDO-based drivers. * Used by all PDO-based drivers.
*/ */
class PDOConnection implements Connection, ServerInfoAwareConnection class PDOConnection implements ServerInfoAwareConnection
{ {
/** @var PDO */ /** @var PDO */
private $connection; private $connection;
......
...@@ -5,7 +5,7 @@ namespace Doctrine\DBAL\Driver; ...@@ -5,7 +5,7 @@ namespace Doctrine\DBAL\Driver;
/** /**
* An interface for connections which support a "native" ping method. * An interface for connections which support a "native" ping method.
*/ */
interface PingableConnection interface PingableConnection extends Connection
{ {
/** /**
* Pings the database server to determine if the connection is still * Pings the database server to determine if the connection is still
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
namespace Doctrine\DBAL\Driver\SQLAnywhere; namespace Doctrine\DBAL\Driver\SQLAnywhere;
use Doctrine\DBAL\Driver\Connection;
use Doctrine\DBAL\Driver\ResultStatement; use Doctrine\DBAL\Driver\ResultStatement;
use Doctrine\DBAL\Driver\ServerInfoAwareConnection; use Doctrine\DBAL\Driver\ServerInfoAwareConnection;
use Doctrine\DBAL\Driver\Statement as DriverStatement; use Doctrine\DBAL\Driver\Statement as DriverStatement;
...@@ -27,7 +26,7 @@ use function sasql_set_option; ...@@ -27,7 +26,7 @@ use function sasql_set_option;
/** /**
* SAP Sybase SQL Anywhere implementation of the Connection interface. * SAP Sybase SQL Anywhere implementation of the Connection interface.
*/ */
class SQLAnywhereConnection implements Connection, ServerInfoAwareConnection class SQLAnywhereConnection implements ServerInfoAwareConnection
{ {
/** @var resource The SQL Anywhere connection resource. */ /** @var resource The SQL Anywhere connection resource. */
private $connection; private $connection;
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
namespace Doctrine\DBAL\Driver\SQLSrv; namespace Doctrine\DBAL\Driver\SQLSrv;
use Doctrine\DBAL\Driver\Connection;
use Doctrine\DBAL\Driver\ResultStatement; use Doctrine\DBAL\Driver\ResultStatement;
use Doctrine\DBAL\Driver\ServerInfoAwareConnection; use Doctrine\DBAL\Driver\ServerInfoAwareConnection;
use Doctrine\DBAL\Driver\Statement as DriverStatement; use Doctrine\DBAL\Driver\Statement as DriverStatement;
...@@ -25,7 +24,7 @@ use function str_replace; ...@@ -25,7 +24,7 @@ use function str_replace;
/** /**
* SQL Server implementation for the Connection interface. * SQL Server implementation for the Connection interface.
*/ */
class SQLSrvConnection implements Connection, ServerInfoAwareConnection class SQLSrvConnection implements ServerInfoAwareConnection
{ {
/** @var resource */ /** @var resource */
protected $conn; protected $conn;
......
...@@ -5,7 +5,7 @@ namespace Doctrine\DBAL\Driver; ...@@ -5,7 +5,7 @@ namespace Doctrine\DBAL\Driver;
/** /**
* Contract for a connection that is able to provide information about the server it is connected to. * Contract for a connection that is able to provide information about the server it is connected to.
*/ */
interface ServerInfoAwareConnection interface ServerInfoAwareConnection extends Connection
{ {
/** /**
* Returns the version number of the database server connected to. * Returns the version number of the database server connected to.
......
...@@ -12,7 +12,7 @@ use Doctrine\DBAL\Platforms\AbstractPlatform; ...@@ -12,7 +12,7 @@ use Doctrine\DBAL\Platforms\AbstractPlatform;
* This interface should be implemented by drivers that are capable to do this * This interface should be implemented by drivers that are capable to do this
* distinction. * distinction.
*/ */
interface VersionAwarePlatformDriver interface VersionAwarePlatformDriver extends Driver
{ {
/** /**
* Factory method for creating the appropriate platform instance for the given version. * Factory method for creating the appropriate platform instance for the given version.
......
...@@ -714,8 +714,8 @@ class ConnectionTest extends DbalTestCase ...@@ -714,8 +714,8 @@ class ConnectionTest extends DbalTestCase
*/ */
public function testPlatformDetectionIsTriggerOnlyOnceOnRetrievingPlatform() : void public function testPlatformDetectionIsTriggerOnlyOnceOnRetrievingPlatform() : void
{ {
/** @var Driver|VersionAwarePlatformDriver|MockObject $driverMock */ /** @var VersionAwarePlatformDriver|MockObject $driverMock */
$driverMock = $this->createMock([Driver::class, VersionAwarePlatformDriver::class]); $driverMock = $this->createMock(VersionAwarePlatformDriver::class);
/** @var ServerInfoAwareConnection|MockObject $driverConnectionMock */ /** @var ServerInfoAwareConnection|MockObject $driverConnectionMock */
$driverConnectionMock = $this->createMock(ServerInfoAwareConnection::class); $driverConnectionMock = $this->createMock(ServerInfoAwareConnection::class);
...@@ -843,8 +843,8 @@ class ConnectionTest extends DbalTestCase ...@@ -843,8 +843,8 @@ class ConnectionTest extends DbalTestCase
*/ */
public function testRethrowsOriginalExceptionOnDeterminingPlatformWhenConnectingToNonExistentDatabase() : void public function testRethrowsOriginalExceptionOnDeterminingPlatformWhenConnectingToNonExistentDatabase() : void
{ {
/** @var Driver|VersionAwarePlatformDriver|MockObject $driverMock */ /** @var VersionAwarePlatformDriver|MockObject $driverMock */
$driverMock = $this->createMock([Driver::class, VersionAwarePlatformDriver::class]); $driverMock = $this->createMock(VersionAwarePlatformDriver::class);
$connection = new Connection(['dbname' => 'foo'], $driverMock); $connection = new Connection(['dbname' => 'foo'], $driverMock);
$originalException = new Exception('Original exception'); $originalException = new Exception('Original exception');
......
...@@ -104,7 +104,7 @@ class OCI8StatementTest extends DbalTestCase ...@@ -104,7 +104,7 @@ class OCI8StatementTest extends DbalTestCase
public function testConvertNonTerminatedLiteral(string $sql, string $message) : void public function testConvertNonTerminatedLiteral(string $sql, string $message) : void
{ {
$this->expectException(OCI8Exception::class); $this->expectException(OCI8Exception::class);
$this->expectExceptionMessageRegExp($message); $this->expectExceptionMessageMatches($message);
OCI8Statement::convertPositionalToNamedPlaceholders($sql); OCI8Statement::convertPositionalToNamedPlaceholders($sql);
} }
......
...@@ -6,7 +6,6 @@ namespace Doctrine\Tests\DBAL\Functional\Driver\IBMDB2; ...@@ -6,7 +6,6 @@ namespace Doctrine\Tests\DBAL\Functional\Driver\IBMDB2;
use Doctrine\DBAL\Driver\IBMDB2\DB2Driver; use Doctrine\DBAL\Driver\IBMDB2\DB2Driver;
use Doctrine\Tests\DbalFunctionalTestCase; use Doctrine\Tests\DbalFunctionalTestCase;
use PHPUnit\Framework\Error\Notice;
use function extension_loaded; use function extension_loaded;
class DB2StatementTest extends DbalFunctionalTestCase class DB2StatementTest extends DbalFunctionalTestCase
...@@ -33,7 +32,7 @@ class DB2StatementTest extends DbalFunctionalTestCase ...@@ -33,7 +32,7 @@ class DB2StatementTest extends DbalFunctionalTestCase
// unwrap the statement to prevent the wrapper from handling the PHPUnit-originated exception // unwrap the statement to prevent the wrapper from handling the PHPUnit-originated exception
$wrappedStmt = $stmt->getWrappedStatement(); $wrappedStmt = $stmt->getWrappedStatement();
$this->expectException(Notice::class); $this->expectNotice();
$wrappedStmt->execute([[]]); $wrappedStmt->execute([[]]);
} }
} }
...@@ -128,7 +128,11 @@ class PortabilityTest extends DbalFunctionalTestCase ...@@ -128,7 +128,11 @@ class PortabilityTest extends DbalFunctionalTestCase
*/ */
public function assertFetchResultRow(array $row) : void public function assertFetchResultRow(array $row) : void
{ {
self::assertContains($row['test_int'], [1, 2], 'Primary key test_int should either be 1 or 2.'); self::assertThat($row['test_int'], self::logicalOr(
self::equalTo(1),
self::equalTo(2)
));
self::assertArrayHasKey('test_string', $row, 'Case should be lowered.'); self::assertArrayHasKey('test_string', $row, 'Case should be lowered.');
self::assertEquals(3, strlen($row['test_string']), 'test_string should be rtrimed to length of three for CHAR(32) column.'); self::assertEquals(3, strlen($row['test_string']), 'test_string should be rtrimed to length of three for CHAR(32) column.');
self::assertNull($row['test_null']); self::assertNull($row['test_null']);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment