markTestSkipped("No gzip - skipping"); } if(!function_exists('simplexml_load_string')) { $this->markTestSkipped("No SimpleXML - skipping"); } parent::setUp(); } public function testSAMLEncoding() { require_once('modules/Users/authentication/SAMLAuthenticate/lib/onelogin/saml.php'); require('modules/Users/authentication/SAMLAuthenticate/settings.php'); $authrequest = new SamlAuthRequest($settings); $url = $authrequest->create(); $query = parse_url($url, PHP_URL_QUERY); $this->assertNotEmpty($query, 'No query part'); parse_str($query, $components); $this->assertArrayHasKey('SAMLRequest', $components); $data = gzinflate(base64_decode(rawurldecode($components['SAMLRequest']))); $this->assertNotEmpty($data, "Data did not decode"); $xml = simplexml_load_string($data, 'SimpleXMLElement', LIBXML_NONET); $this->assertNotEmpty($xml, 'XML did not parse'); $myurl = $xml['AssertionConsumerServiceURL']; $this->assertNotEmpty($myurl, 'URL not found'); $this->assertEquals(parse_url($GLOBALS['sugar_config']['site_url']. "/index.php", PHP_URL_PATH), parse_url($myurl, PHP_URL_PATH), "Bad URL"); } }