public function testGetById() { $model = new Session(); $model->setId('2b73fftuqqa84lha6jt4pcl097')->setName('uthando-cms')->setModified('1398807915')->setLifetime(1440)->setData(''); $mapperMock = $this->getMockBuilder('UthandoSessionManager\\Mapper\\Session')->disableOriginalConstructor()->getMock(); $mapperManagerMock = $this->getMockBuilder('UthandoCommon\\Mapper\\MapperManager')->disableOriginalConstructor()->getMock(); $mapperMock->expects($this->once())->method('getById')->with('2b73fftuqqa84lha6jt4pcl097')->will($this->returnValue($model)); $mapperManagerMock->expects($this->once())->method('get')->with('UthandoSessionManagerSession')->will($this->returnValue($mapperMock)); $this->serviceManager->setAllowOverride(true); $this->serviceManager->setService('UthandoMapperManager', $mapperManagerMock); $service = $this->serviceManager->get('UthandoServiceManager')->get('UthandoSessionManagerSession'); $this->assertSame($model, $service->getById('2b73fftuqqa84lha6jt4pcl097')); }
/** * @param \UthandoSessionManager\Model\Session $object * @return array */ public function extract($object) { return ['id' => $object->getId(), 'name' => $object->getName(), 'modified' => $object->getModified(), 'lifetime' => $object->getLifetime(), 'data' => $object->getData()]; }
public function testSetGetData() { $this->model->setData('some data'); $this->assertSame('some data', $this->model->getData()); }