public function test_serialization() { $state = new SsoSessionState(); $state->setIdpEntityId('idp'); $state->setSpEntityId('sp'); $state->setNameId('name-id'); $state->setNameIdFormat('name-id-format'); $state->setSessionIndex('session-index'); $state->getParameters()->replace(['a' => 'abc', 'b' => 22, 'c' => [1, 2]]); /** @var SsoSessionState $other */ $other = unserialize(serialize($state)); $this->assertInstanceOf(SsoSessionState::class, $other); $this->assertInstanceOf(ParameterBag::class, $other->getParameters()); $this->assertEquals($state->getIdpEntityId(), $other->getIdpEntityId()); $this->assertEquals($state->getSpEntityId(), $other->getSpEntityId()); $this->assertEquals($state->getNameId(), $other->getNameId()); $this->assertEquals($state->getNameIdFormat(), $other->getNameIdFormat()); $this->assertEquals($state->getSessionIndex(), $other->getSessionIndex()); $this->assertEquals($state->getParameters()->all(), $other->getParameters()->all()); }