コード例 #1
0
    public function test_deserialize_invalid02()
    {
        $context = new DeserializationContext();
        $context->getDocument()->load(__DIR__ . '/../../../../../../resources/sample/Response/invalid02.xml');
        $response = new Response();
        $response->deserialize($context->getDocument(), $context);
        $this->assertEquals('_274be8a4-c2ba-43ca-a7c6-2f1613762576', $response->getID());
        $this->assertEquals('2.0', $response->getVersion());
        $this->assertEquals('2013-11-17T12:35:10Z', $response->getIssueInstantString());
        $this->assertEquals('_b04e5e6166a0ba08f3ae9327a7145498e9f8a60e2f', $response->getInResponseTo());
        $this->assertNotNull($response->getIssuer());
        $this->assertEquals('https://sts.windows.net/554fadfe-f04f-4975-90cb-ddc8b147aaa2/', $response->getIssuer()->getValue());
        $this->assertNotNull($response->getStatus());
        $this->assertEquals(SamlConstants::STATUS_REQUESTER, $response->getStatus()->getStatusCode()->getValue());
        $this->assertEquals(SamlConstants::STATUS_UNSUPPORTED_BINDING, $response->getStatus()->getStatusCode()->getStatusCode()->getValue());
        $expectedMessage = <<<EOT
ACS75006: An error occurred while processing a SAML2 Authentication request. ACS75003: SAML protocol response cannot be sent via bindings other than HTTP POST. Requested binding: urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect
            Trace ID: d75d5305-d3fc-40b0-9087-d59032682dd9
            Correlation ID: ca26b4bd-23d4-4233-9c28-96bc0a336c39
            Timestamp: 2013-11-17 12:35:10Z
EOT;
        $expectedMessage = trim(str_replace("\r", '', $expectedMessage));
        $this->assertEquals($expectedMessage, trim(str_replace("\r", '', $response->getStatus()->getStatusMessage())));
        $this->assertCount(0, $response->getAllAssertions());
    }