Skip to content

Commit

Permalink
Update unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
chosroes committed Jan 6, 2020
1 parent 06df782 commit 8381c9b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 27 deletions.
22 changes: 0 additions & 22 deletions tests/Doctrine/Tests/Mocks/ConnectionCommitFailMock.php

This file was deleted.

11 changes: 6 additions & 5 deletions tests/Doctrine/Tests/ORM/UnitOfWorkTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -798,11 +798,12 @@ public function testPreviousDetectedIllegalNewNonCascadedEntitiesAreCleanedUpOnS
public function testCommitThrowOptimisticLockExceptionWhenConnectionCommitReturnFalse(): void
{
// Set another connection mock that fail on commit
$this->_connectionMock = new ConnectionCommitFailMock([], new DriverMock());
$this->eventManager = $this->getMockBuilder(EventManager::class)->getMock();
$this->_emMock = EntityManagerMock::create($this->_connectionMock, null, $this->eventManager);
$this->_unitOfWork = new UnitOfWorkMock($this->_emMock);
$this->_emMock->setUnitOfWork($this->_unitOfWork);
$this->_connectionMock = $this->getMockBuilder(ConnectionMock::class)
->setConstructorArgs([[], new DriverMock()])
->setMethods(['commit'])
->getMock();

$this->_connectionMock->method('commit')->willReturn(false);

// Setup fake persister and id generator
$userPersister = new EntityPersisterMock($this->_emMock, $this->_emMock->getClassMetadata(ForumUser::class));
Expand Down

0 comments on commit 8381c9b

Please sign in to comment.