public function test_adds_sso_session_state() { $state = new SsoState(); $session1 = new SsoSessionState(); $session1->setIdpEntityId($session1Idp = 'http://idp-1.com'); $session1->setSpEntityId($session1sp = 'http://sp-1.com'); $state->addSsoSession($session1); $this->assertTrue(is_array($state->getSsoSessions())); $this->assertCount(1, $state->getSsoSessions()); $session2 = new SsoSessionState(); $session2->setIdpEntityId($session1Idp = 'http://idp-2.com'); $session2->setSpEntityId($session1sp = 'http://sp-2.com'); $state->addSsoSession($session1); $this->assertCount(2, $state->getSsoSessions()); }
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()); }