Unverified Commit a2450fb0 authored by Sergei Morozov's avatar Sergei Morozov Committed by GitHub

Merge pull request #3566 from morozov/phpunit-816

Upgraded to PHPUnit 8.1.6 and reworked the remaining driver exception mock
parents 5b64cbd8 a7acb477
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "7c55573f97bd2526e2b02609d5e5290c", "content-hash": "20970a03470d26a047432b1e25bb4a2a",
"packages": [ "packages": [
{ {
"name": "doctrine/cache", "name": "doctrine/cache",
...@@ -1788,16 +1788,16 @@ ...@@ -1788,16 +1788,16 @@
}, },
{ {
"name": "phpunit/phpunit", "name": "phpunit/phpunit",
"version": "8.1.5", "version": "8.1.6",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git", "url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "01392d4b5878aa617e8d9bc7a529e5febc8fe956" "reference": "e3c9da6e645492c461e0a11eca117f83f4f4c840"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/01392d4b5878aa617e8d9bc7a529e5febc8fe956", "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/e3c9da6e645492c461e0a11eca117f83f4f4c840",
"reference": "01392d4b5878aa617e8d9bc7a529e5febc8fe956", "reference": "e3c9da6e645492c461e0a11eca117f83f4f4c840",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
...@@ -1866,7 +1866,7 @@ ...@@ -1866,7 +1866,7 @@
"testing", "testing",
"xunit" "xunit"
], ],
"time": "2019-05-14T04:57:31+00:00" "time": "2019-05-28T11:53:42+00:00"
}, },
{ {
"name": "psr/log", "name": "psr/log",
......
...@@ -28,7 +28,7 @@ use Doctrine\DBAL\Platforms\AbstractPlatform; ...@@ -28,7 +28,7 @@ use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Schema\AbstractSchemaManager; use Doctrine\DBAL\Schema\AbstractSchemaManager;
use Doctrine\DBAL\VersionAwarePlatformDriver; use Doctrine\DBAL\VersionAwarePlatformDriver;
use Doctrine\Tests\DbalTestCase; use Doctrine\Tests\DbalTestCase;
use Exception; use PHPUnit\Framework\MockObject\MockObject;
use ReflectionProperty; use ReflectionProperty;
use function array_merge; use function array_merge;
use function get_class; use function get_class;
...@@ -77,40 +77,14 @@ abstract class AbstractDriverTest extends DbalTestCase ...@@ -77,40 +77,14 @@ abstract class AbstractDriverTest extends DbalTestCase
$this->markTestSkipped('This test is only intended for exception converter drivers.'); $this->markTestSkipped('This test is only intended for exception converter drivers.');
} }
$driverException = new class ($errorCode, $sqlState, $message) /** @var DriverExceptionInterface|MockObject $driverException */
extends Exception $driverException = $this->getMockBuilder(DriverExceptionInterface::class)
implements DriverExceptionInterface ->setConstructorArgs([$message])
{ ->getMock();
/** @var mixed */ $driverException->method('getErrorCode')
private $errorCode; ->willReturn($errorCode);
$driverException->method('getSQLState')
/** @var mixed */ ->willReturn($sqlState);
private $sqlState;
public function __construct($errorCode, $sqlState, $message)
{
parent::__construct($message);
$this->errorCode = $errorCode;
$this->sqlState = $sqlState;
}
/**
* {@inheritDoc}
*/
public function getErrorCode()
{
return $this->errorCode;
}
/**
* {@inheritDoc}
*/
public function getSQLState()
{
return $this->sqlState;
}
};
$dbalMessage = 'DBAL exception message'; $dbalMessage = 'DBAL exception message';
$dbalException = $this->driver->convertException($dbalMessage, $driverException); $dbalException = $this->driver->convertException($dbalMessage, $driverException);
......
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