Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade PHPUnit to 9.0 #3903

Merged
merged 3 commits into from
Mar 17, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# 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.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -41,7 +41,7 @@
"doctrine/coding-standard": "^6.0",
"jetbrains/phpstorm-stubs": "^2019.1",
"phpstan/phpstan": "^0.11.3",
"phpunit/phpunit": "^8.4.1",
"phpunit/phpunit": "^9.0",
"symfony/console": "^2.0.5|^3.0|^4.0|^5.0"
},
"suggest": {
552 changes: 308 additions & 244 deletions composer.lock

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php
Original file line number Diff line number Diff line change
@@ -4,7 +4,6 @@

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 @@
/**
* 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}
3 changes: 1 addition & 2 deletions lib/Doctrine/DBAL/Driver/AbstractPostgreSQLDriver.php
Original file line number Diff line number Diff line change
@@ -4,7 +4,6 @@

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 @@
/**
* 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}
3 changes: 1 addition & 2 deletions lib/Doctrine/DBAL/Driver/AbstractSQLAnywhereDriver.php
Original file line number Diff line number Diff line change
@@ -4,7 +4,6 @@

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 @@
/**
* 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}
3 changes: 1 addition & 2 deletions lib/Doctrine/DBAL/Driver/AbstractSQLServerDriver.php
Original file line number Diff line number Diff line change
@@ -4,7 +4,6 @@

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 @@
/**
* 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}
3 changes: 1 addition & 2 deletions lib/Doctrine/DBAL/Driver/IBMDB2/DB2Connection.php
Original file line number Diff line number Diff line change
@@ -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_server_info;
use function db2_stmt_errormsg;

class DB2Connection implements Connection, ServerInfoAwareConnection
class DB2Connection implements ServerInfoAwareConnection
{
/** @var resource */
private $conn = null;
3 changes: 1 addition & 2 deletions lib/Doctrine/DBAL/Driver/Mysqli/MysqliConnection.php
Original file line number Diff line number Diff line change
@@ -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 sprintf;
use function stripos;

class MysqliConnection implements Connection, PingableConnection, ServerInfoAwareConnection
class MysqliConnection implements PingableConnection, ServerInfoAwareConnection
{
/**
* Name of the option to set connection flags
2 changes: 1 addition & 1 deletion lib/Doctrine/DBAL/Driver/PDOConnection.php
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@
*
* Used by all PDO-based drivers.
*/
class PDOConnection implements Connection, ServerInfoAwareConnection
class PDOConnection implements ServerInfoAwareConnection
{
/** @var PDO */
private $connection;
2 changes: 1 addition & 1 deletion lib/Doctrine/DBAL/Driver/PingableConnection.php
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
/**
* 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
Original file line number Diff line number Diff line change
@@ -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 @@
/**
* 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;
3 changes: 1 addition & 2 deletions lib/Doctrine/DBAL/Driver/SQLSrv/SQLSrvConnection.php
Original file line number Diff line number Diff line change
@@ -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 @@
/**
* SQL Server implementation for the Connection interface.
*/
class SQLSrvConnection implements Connection, ServerInfoAwareConnection
class SQLSrvConnection implements ServerInfoAwareConnection
{
/** @var resource */
protected $conn;
2 changes: 1 addition & 1 deletion lib/Doctrine/DBAL/Driver/ServerInfoAwareConnection.php
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
/**
* 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.
2 changes: 1 addition & 1 deletion lib/Doctrine/DBAL/VersionAwarePlatformDriver.php
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
* 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.
8 changes: 4 additions & 4 deletions tests/Doctrine/Tests/DBAL/ConnectionTest.php
Original file line number Diff line number Diff line change
@@ -714,8 +714,8 @@ public function testCallConnectOnce() : void
*/
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 @@ public function testThrowsExceptionWhenInValidPlatformSpecified() : void
*/
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');
Original file line number Diff line number Diff line change
@@ -104,7 +104,7 @@ public static function executeDataProvider() : iterable
public function testConvertNonTerminatedLiteral(string $sql, string $message) : void
{
$this->expectException(OCI8Exception::class);
$this->expectExceptionMessageRegExp($message);
$this->expectExceptionMessageMatches($message);
OCI8Statement::convertPositionalToNamedPlaceholders($sql);
}

Original file line number Diff line number Diff line change
@@ -6,7 +6,6 @@

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 @@ public function testExecutionErrorsAreNotSuppressed() : void
// unwrap the statement to prevent the wrapper from handling the PHPUnit-originated exception
$wrappedStmt = $stmt->getWrappedStatement();

$this->expectException(Notice::class);
$this->expectNotice();
$wrappedStmt->execute([[]]);
}
}
6 changes: 5 additions & 1 deletion tests/Doctrine/Tests/DBAL/Functional/PortabilityTest.php
Original file line number Diff line number Diff line change
@@ -128,7 +128,11 @@ private function assertFetchResultRows(array $rows) : 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::assertEquals(3, strlen($row['test_string']), 'test_string should be rtrimed to length of three for CHAR(32) column.');
self::assertNull($row['test_null']);