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 committed Feb 22, 2018
1 parent 883ce87 commit 407a70d
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 @@ -132,7 +133,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 @@ -173,7 +174,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 407a70d

Please sign in to comment.