/** * Tests the checkStatus method of the OneLogin_Saml2_Response * * @covers OneLogin_Saml2_Response::checkStatus */ public function testCheckStatus() { $xml = file_get_contents(TEST_ROOT . '/data/responses/response1.xml.base64'); $response = new OneLogin_Saml2_Response($this->_settings, $xml); $response->checkStatus(); $xmlEnc = file_get_contents(TEST_ROOT . '/data/responses/valid_encrypted_assertion.xml.base64'); $responseEnc = new OneLogin_Saml2_Response($this->_settings, $xmlEnc); $response->checkStatus(); $xml2 = file_get_contents(TEST_ROOT . '/data/responses/invalids/status_code_responder.xml.base64'); $response2 = new OneLogin_Saml2_Response($this->_settings, $xml2); try { $response2->checkStatus(); $this->assertTrue(false); } catch (Exception $e) { $this->assertContains('The status code of the Response was not Success, was Responder', $e->getMessage()); } $xml3 = file_get_contents(TEST_ROOT . '/data/responses/invalids/status_code_responer_and_msg.xml.base64'); $response3 = new OneLogin_Saml2_Response($this->_settings, $xml3); try { $response3->checkStatus(); $this->assertTrue(false); } catch (Exception $e) { $this->assertContains('The status code of the Response was not Success, was Responder -> something_is_wrong', $e->getMessage()); } }