Skip to content

Commit

Permalink
[Workaround] .... until sebastianbergmann/phpunit-mock-objects#402 is…
Browse files Browse the repository at this point in the history
… merged and released
  • Loading branch information
DeepDiver1975 authored and phil-davis committed Jul 4, 2019
1 parent 576703f commit dc75630
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tests/lib/DB/AdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

namespace Test\DB;
use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Driver\AbstractDriverException;
use Doctrine\DBAL\Driver\DriverException;
use OC\DB\Adapter;
use OCP\DB\QueryBuilder\IExpressionBuilder;
Expand Down Expand Up @@ -131,7 +132,7 @@ public function testUpsertCatchDeadlockAndThrowsException() {
$qb->expects($this->exactly(3))->method('set')->willReturn($qb);
$qb->expects($this->exactly(3))->method('setValue')->willReturn($qb);
// Make a deadlock driver exception
$ex = $this->createMock(DriverException::class);
$ex = $this->createMock(AbstractDriverException::class);
$ex->expects($this->exactly(5))->method('getErrorCode')->willReturn(1213);
// Wrap the exception in a doctrine exception
$e = new \Doctrine\DBAL\Exception\DriverException('1213', $ex);
Expand Down Expand Up @@ -170,7 +171,7 @@ public function testUpsertAndThrowOtherDriverExceptions() {
$qb->expects($this->exactly(3))->method('set')->willReturn($qb);
$qb->expects($this->exactly(3))->method('setValue')->willReturn($qb);
// Make a deadlock driver exception
$ex = $this->createMock(DriverException::class);
$ex = $this->createMock(AbstractDriverException::class);
$ex->expects($this->exactly(1))->method('getErrorCode')->willReturn(1214);
// Wrap the exception in a doctrine exception
/** @var DriverException|\PHPUnit\Framework\MockObject\MockObject $ex */
Expand Down

0 comments on commit dc75630

Please sign in to comment.