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
## 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
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;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Driver;
use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Platforms\MariaDb1027Platform;
use Doctrine\DBAL\Platforms\MySQL57Platform;
......@@ -19,7 +18,7 @@ use function version_compare;
/**
* 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}
......
......@@ -4,7 +4,6 @@ namespace Doctrine\DBAL\Driver;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Driver;
use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Platforms\PostgreSQL100Platform;
use Doctrine\DBAL\Platforms\PostgreSQL91Platform;
......@@ -20,7 +19,7 @@ use function version_compare;
/**
* 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}
......
......@@ -4,7 +4,6 @@ namespace Doctrine\DBAL\Driver;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Driver;
use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Platforms\SQLAnywhere11Platform;
use Doctrine\DBAL\Platforms\SQLAnywhere12Platform;
......@@ -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 class AbstractSQLAnywhereDriver implements Driver, ExceptionConverterDriver, VersionAwarePlatformDriver
abstract class AbstractSQLAnywhereDriver implements ExceptionConverterDriver, VersionAwarePlatformDriver
{
/**
* {@inheritdoc}
......
......@@ -4,7 +4,6 @@ namespace Doctrine\DBAL\Driver;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Driver;
use Doctrine\DBAL\Platforms\SQLServer2005Platform;
use Doctrine\DBAL\Platforms\SQLServer2008Platform;
use Doctrine\DBAL\Platforms\SQLServer2012Platform;
......@@ -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 class AbstractSQLServerDriver implements Driver, VersionAwarePlatformDriver
abstract class AbstractSQLServerDriver implements VersionAwarePlatformDriver
{
/**
* {@inheritdoc}
......
......@@ -2,7 +2,6 @@
namespace Doctrine\DBAL\Driver\IBMDB2;
use Doctrine\DBAL\Driver\Connection;
use Doctrine\DBAL\Driver\ResultStatement;
use Doctrine\DBAL\Driver\ServerInfoAwareConnection;
use Doctrine\DBAL\Driver\Statement as DriverStatement;
......@@ -25,7 +24,7 @@ use function db2_rollback;
use function db2_server_info;
use function db2_stmt_errormsg;
class DB2Connection implements Connection, ServerInfoAwareConnection
class DB2Connection implements ServerInfoAwareConnection
{
/** @var resource */
private $conn = null;
......
......@@ -2,7 +2,6 @@
namespace Doctrine\DBAL\Driver\Mysqli;
use Doctrine\DBAL\Driver\Connection;
use Doctrine\DBAL\Driver\PingableConnection;
use Doctrine\DBAL\Driver\ResultStatement;
use Doctrine\DBAL\Driver\ServerInfoAwareConnection;
......@@ -28,7 +27,7 @@ use function set_error_handler;
use function sprintf;
use function stripos;
class MysqliConnection implements Connection, PingableConnection, ServerInfoAwareConnection
class MysqliConnection implements PingableConnection, ServerInfoAwareConnection
{
/**
* Name of the option to set connection flags
......
......@@ -11,7 +11,7 @@ use function assert;
*
* Used by all PDO-based drivers.
*/
class PDOConnection implements Connection, ServerInfoAwareConnection
class PDOConnection implements ServerInfoAwareConnection
{
/** @var PDO */
private $connection;
......
......@@ -5,7 +5,7 @@ namespace Doctrine\DBAL\Driver;
/**
* 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
......
......@@ -2,7 +2,6 @@
namespace Doctrine\DBAL\Driver\SQLAnywhere;
use Doctrine\DBAL\Driver\Connection;
use Doctrine\DBAL\Driver\ResultStatement;
use Doctrine\DBAL\Driver\ServerInfoAwareConnection;
use Doctrine\DBAL\Driver\Statement as DriverStatement;
......@@ -27,7 +26,7 @@ use function sasql_set_option;
/**
* 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. */
private $connection;
......
......@@ -2,7 +2,6 @@
namespace Doctrine\DBAL\Driver\SQLSrv;
use Doctrine\DBAL\Driver\Connection;
use Doctrine\DBAL\Driver\ResultStatement;
use Doctrine\DBAL\Driver\ServerInfoAwareConnection;
use Doctrine\DBAL\Driver\Statement as DriverStatement;
......@@ -25,7 +24,7 @@ use function str_replace;
/**
* SQL Server implementation for the Connection interface.
*/
class SQLSrvConnection implements Connection, ServerInfoAwareConnection
class SQLSrvConnection implements ServerInfoAwareConnection
{
/** @var resource */
protected $conn;
......
......@@ -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.
*/
interface ServerInfoAwareConnection
interface ServerInfoAwareConnection extends Connection
{
/**
* Returns the version number of the database server connected to.
......
......@@ -12,7 +12,7 @@ use Doctrine\DBAL\Platforms\AbstractPlatform;
* This interface should be implemented by drivers that are capable to do this
* distinction.
*/
interface VersionAwarePlatformDriver
interface VersionAwarePlatformDriver extends Driver
{
/**
* Factory method for creating the appropriate platform instance for the given version.
......
......@@ -714,8 +714,8 @@ class ConnectionTest extends DbalTestCase
*/
public function testPlatformDetectionIsTriggerOnlyOnceOnRetrievingPlatform() : void
{
/** @var Driver|VersionAwarePlatformDriver|MockObject $driverMock */
$driverMock = $this->createMock([Driver::class, VersionAwarePlatformDriver::class]);
/** @var VersionAwarePlatformDriver|MockObject $driverMock */
$driverMock = $this->createMock(VersionAwarePlatformDriver::class);
/** @var ServerInfoAwareConnection|MockObject $driverConnectionMock */
$driverConnectionMock = $this->createMock(ServerInfoAwareConnection::class);
......@@ -843,8 +843,8 @@ class ConnectionTest extends DbalTestCase
*/
public function testRethrowsOriginalExceptionOnDeterminingPlatformWhenConnectingToNonExistentDatabase() : void
{
/** @var Driver|VersionAwarePlatformDriver|MockObject $driverMock */
$driverMock = $this->createMock([Driver::class, VersionAwarePlatformDriver::class]);
/** @var VersionAwarePlatformDriver|MockObject $driverMock */
$driverMock = $this->createMock(VersionAwarePlatformDriver::class);
$connection = new Connection(['dbname' => 'foo'], $driverMock);
$originalException = new Exception('Original exception');
......
......@@ -104,7 +104,7 @@ class OCI8StatementTest extends DbalTestCase
public function testConvertNonTerminatedLiteral(string $sql, string $message) : void
{
$this->expectException(OCI8Exception::class);
$this->expectExceptionMessageRegExp($message);
$this->expectExceptionMessageMatches($message);
OCI8Statement::convertPositionalToNamedPlaceholders($sql);
}
......
......@@ -6,7 +6,6 @@ namespace Doctrine\Tests\DBAL\Functional\Driver\IBMDB2;
use Doctrine\DBAL\Driver\IBMDB2\DB2Driver;
use Doctrine\Tests\DbalFunctionalTestCase;
use PHPUnit\Framework\Error\Notice;
use function extension_loaded;
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
$wrappedStmt = $stmt->getWrappedStatement();
$this->expectException(Notice::class);
$this->expectNotice();
$wrappedStmt->execute([[]]);
}
}
......@@ -128,7 +128,11 @@ class PortabilityTest extends DbalFunctionalTestCase
*/
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::assertEquals(3, strlen($row['test_string']), 'test_string should be rtrimed to length of three for CHAR(32) column.');
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