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