public function test_serialization_and_deserialization() { $state = new SsoSessionState(); $state->setIdpEntityId($idp = 'IDP')->setSpEntityId($sp = 'SP')->setNameId($nameId = 'name.id')->setNameIdFormat($nameIdFormat = 'name.id.format')->setSessionIndex($sessionIndex = 'session.index')->setFirstAuthOn($firstAuthOn = new \DateTime('2015-10-27 08:00:00'))->setLastAuthOn($lastAuthOn = new \DateTime('2015-10-27 10:00:00'))->setSessionInstant($sessionInstant = new \DateTime('2015-10-27 06:00:00')); $data = $state->serialize(); $otherState = new SsoSessionState(); $otherState->unserialize($data); $this->assertEquals($state->getIdpEntityId(), $otherState->getIdpEntityId()); $this->assertEquals($state->getSpEntityId(), $otherState->getSpEntityId()); $this->assertEquals($state->getNameId(), $otherState->getNameId()); $this->assertEquals($state->getNameIdFormat(), $otherState->getNameIdFormat()); $this->assertEquals($state->getSessionIndex(), $otherState->getSessionIndex()); $this->assertEquals($state->getFirstAuthOn(), $otherState->getFirstAuthOn()); $this->assertEquals($state->getLastAuthOn(), $otherState->getLastAuthOn()); $this->assertEquals($state->getSessionInstant(), $otherState->getSessionInstant()); }