public function test_serialize_deserialize() { $arrIdp = ['http://idp-1.com', 'http://idp-2.com', 'http://idp-3.com']; $arrSp = ['http://sp-1.com', 'http://sp-2.com', 'http://sp-3.com']; $state = $this->buildAllStateCombinations($arrIdp, $arrSp); $state->addOption('a', 1); $state->addOption('b', 2); $sessions = $state->getSsoSessions(); $data = $state->serialize(); $otherState = new SsoState(); $otherState->unserialize($data); $otherSessions = $otherState->getSsoSessions(); $this->assertEquals($state->getOptions(), $otherState->getOptions()); $this->assertEquals(count($sessions), count($otherSessions)); foreach ($sessions as $k => $session) { $this->assertEquals($session->getIdpEntityId(), $otherSessions[$k]->getIdpEntityId()); $this->assertEquals($session->getSpEntityId(), $otherSessions[$k]->getSpEntityId()); } }