function testUpdateDirtyObject() { $mapper = new AbstractDataMapperMock($this); $this->uow->expectOnce('isDirty', array($this->object)); $this->uow->setReturnValue('isDirty', true); $this->uow->expectOnce('isNew', array($this->object)); $this->uow->setReturnValue('isNew', false); $mapper->expectNever('insert'); $mapper->expectOnce('update', array($this->object)); $mapper->save($this->object); $mapper->tally(); }
function testSaveUpdate() { $mapper = new AbstractDataMapperMock($this); $mapper->expectOnce('update', array(new IsAExpectation('MockDomainObject'))); $this->object->expectOnce('getId'); $this->object->setReturnValue('getId', 10); $mapper->save($this->object); $mapper->tally(); }