function testFindByIdNull() { $mapper = new AbstractDataMapperMock($this); $mapper->setReturnValue('_getFinder', $this->finder); $this->finder->expectOnce('findById', array($id = 100)); $this->finder->setReturnValue('findById', array(), array($id = 100)); $mapper->expectNever('_createDomainObject'); $mapper->expectNever('_doLoad'); $this->assertNull($mapper->findById($id)); $mapper->tally(); }
function testDontUpdateUnchangedObject() { $mapper = new AbstractDataMapperMock($this); $this->uow->expectOnce('isNew', array($this->object)); $this->uow->setReturnValue('isNew', false); $this->uow->expectOnce('isDirty', array($this->object)); $this->uow->setReturnValue('isDirty', false); $mapper->expectNever('update'); $mapper->expectNever('insert'); $mapper->save($this->object); $mapper->tally(); }