public function testDisabledRemove() { $storage = $this->getMockBuilder('SFM\\IdentityMap\\IdentityMapStorage')->getMock(); $storage1 = $this->getMockBuilder('SFM\\IdentityMap\\IdentityMapStorage')->getMock(); $storage2 = $this->getMockBuilder('SFM\\IdentityMap\\IdentityMapStorage')->getMock(); $entity = $this->getMockBuilder('SFM\\Entity')->disableOriginalConstructor()->setMockClassName('SampleEntity')->getMock(); $entity->expects($this->any())->method('getId')->willReturn(1); $im = new IdentityMap($storage, $storage1, $storage2); $im->disable(); $storage->expects($this->never())->method('remove'); $im->deleteEntity($entity); }
public function testCommitRollback2() { $this->setExpectedException('SFM\\Transaction\\TransactionException', "Transaction already stopped"); $im = new IdentityMap(new \SFM\IdentityMap\IdentityMapStorage(), new \SFM\IdentityMap\IdentityMapStorage(), new \SFM\IdentityMap\IdentityMapStorage()); $im->beginTransaction(); $im->commitTransaction(); $im->rollbackTransaction(); }