diff --git a/modules/consentAdmin/www/includes/consentSimpleAjax.js b/modules/consentAdmin/www/includes/consentSimpleAjax.js index 1aaa5f3316a68037b4090fba9a735611f40504e5..7ea896c630fa05a2f269330d63f7d70a4837232f 100644 --- a/modules/consentAdmin/www/includes/consentSimpleAjax.js +++ b/modules/consentAdmin/www/includes/consentSimpleAjax.js @@ -1,70 +1,70 @@ -var xmlHttp; - -function checkConsent(consentValue, show_spid, checkAction) -{ - xmlHttp=GetXmlHttpObject() - if (xmlHttp==null) { - alert ("Browser does not support HTTP Request") - - return - } - - var url="consentAdmin.php" - url=url+"?cv="+consentValue - url=url+"&action="+checkAction - url=url+"&sid="+Math.random() - xmlHttp.onreadystatechange=function() { - if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") - { - setConsentText(xmlHttp.responseText, show_spid); - } -} - - xmlHttp.open("GET",url,true) - xmlHttp.send(null) -} - -// This function will be automaticly called when the Ajax call is done returning data -function stateChanged() { - if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") - { - //Alert("Status of consent:" + xmlHttp.responseText ); - } -} - -// This function creates an XMLHttpRequest -function GetXmlHttpObject() { - var xmlHttp=null; - try - { - // Firefox, Opera 8.0+, Safari - xmlHttp=new XMLHttpRequest(); - } - catch (e) - { - //Internet Explorer - try - { - xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); - } - catch (e) - { - xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); - } - } - - return xmlHttp; -} - -function toggleShowAttributes(show_spid) { - var disp = document.getElementById('attributes_' + show_spid); - //var showhide = document.getElementById('showhide_' + show_spid); - var showing = document.getElementById('showing_' + show_spid); - var hiding = document.getElementById('hiding_' + show_spid); - - disp.style.display = (disp.style.display == 'none' ? 'block' : 'none'); - //showhide.innerHTML = (disp.style.display == 'none' ? 'Show' : 'Hide') - showing.style.display = (disp.style.display == 'none' ? 'inline' : 'none'); - hiding.style.display = (disp.style.display == 'none' ? 'none' : 'inline'); - //alert('hiding display'+hiding.display); -} +var xmlHttp; + +function checkConsent(consentValue, show_spid, checkAction) +{ + xmlHttp=GetXmlHttpObject() + if (xmlHttp==null) { + alert ("Browser does not support HTTP Request") + + return + } + + var url="consentAdmin.php" + url=url+"?cv="+consentValue + url=url+"&action="+checkAction + url=url+"&sid="+Math.random() + xmlHttp.onreadystatechange=function() { + if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") + { + setConsentText(xmlHttp.responseText, show_spid); + } +} + + xmlHttp.open("GET",url,true) + xmlHttp.send(null) +} + +// This function will be automaticly called when the Ajax call is done returning data +function stateChanged() { + if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") + { + //Alert("Status of consent:" + xmlHttp.responseText ); + } +} + +// This function creates an XMLHttpRequest +function GetXmlHttpObject() { + var xmlHttp=null; + try + { + // Firefox, Opera 8.0+, Safari + xmlHttp=new XMLHttpRequest(); + } + catch (e) + { + //Internet Explorer + try + { + xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); + } + catch (e) + { + xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); + } + } + + return xmlHttp; +} + +function toggleShowAttributes(show_spid) { + var disp = document.getElementById('attributes_' + show_spid); + //var showhide = document.getElementById('showhide_' + show_spid); + var showing = document.getElementById('showing_' + show_spid); + var hiding = document.getElementById('hiding_' + show_spid); + + disp.style.display = (disp.style.display == 'none' ? 'block' : 'none'); + //showhide.innerHTML = (disp.style.display == 'none' ? 'Show' : 'Hide') + showing.style.display = (disp.style.display == 'none' ? 'inline' : 'none'); + hiding.style.display = (disp.style.display == 'none' ? 'none' : 'inline'); + //alert('hiding display'+hiding.display); +} diff --git a/tests/lib/SimpleSAML/Utils/ConfigTest.php b/tests/lib/SimpleSAML/Utils/ConfigTest.php index f3f090b434a8d80d2aa1e96b9c8231f86b1a6dc5..5dd0fa33b1ad2dca80bd5d43a530af385a7ca532 100644 --- a/tests/lib/SimpleSAML/Utils/ConfigTest.php +++ b/tests/lib/SimpleSAML/Utils/ConfigTest.php @@ -1,55 +1,55 @@ -<?php - -namespace SimpleSAML\Test\Utils; - -use SimpleSAML\Utils\Config; - -/** - * Tests for SimpleSAML\Utils\Config - */ -class ConfigTest extends \PHPUnit_Framework_TestCase -{ - - /** - * Test default config dir with not environment variable - */ - public function testDefaultConfigDir() - { - // clear env var - putenv('SIMPLESAMLPHP_CONFIG_DIR'); - $configDir = Config::getConfigDir(); - - $this->assertEquals($configDir, dirname(dirname(dirname(dirname(__DIR__)))) . '/config'); - } - - - /** - * Test valid dir specified by env var overrides default config dir - */ - public function testEnvVariableConfigDir() - { - putenv('SIMPLESAMLPHP_CONFIG_DIR=' . __DIR__); - $configDir = Config::getConfigDir(); - - $this->assertEquals($configDir, __DIR__); - } - - - /** - * Test invalid dir specified by env var results in a thrown exception - */ - public function testInvalidEnvVariableConfigDirThrowsException() - { - // I used a random hash to ensure this test directory is always invalid - $invalidDir = __DIR__ . '/e9826ad19cbc4f5bf20c0913ffcd2ce6'; - putenv('SIMPLESAMLPHP_CONFIG_DIR=' . $invalidDir); - - $this->setExpectedException( - 'InvalidArgumentException', - 'Config directory specified by environment variable SIMPLESAMLPHP_CONFIG_DIR is not a directory. ' . - 'Given: "' . $invalidDir . '"' - ); - - Config::getConfigDir(); - } -} +<?php + +namespace SimpleSAML\Test\Utils; + +use SimpleSAML\Utils\Config; + +/** + * Tests for SimpleSAML\Utils\Config + */ +class ConfigTest extends \PHPUnit_Framework_TestCase +{ + + /** + * Test default config dir with not environment variable + */ + public function testDefaultConfigDir() + { + // clear env var + putenv('SIMPLESAMLPHP_CONFIG_DIR'); + $configDir = Config::getConfigDir(); + + $this->assertEquals($configDir, dirname(dirname(dirname(dirname(__DIR__)))) . '/config'); + } + + + /** + * Test valid dir specified by env var overrides default config dir + */ + public function testEnvVariableConfigDir() + { + putenv('SIMPLESAMLPHP_CONFIG_DIR=' . __DIR__); + $configDir = Config::getConfigDir(); + + $this->assertEquals($configDir, __DIR__); + } + + + /** + * Test invalid dir specified by env var results in a thrown exception + */ + public function testInvalidEnvVariableConfigDirThrowsException() + { + // I used a random hash to ensure this test directory is always invalid + $invalidDir = __DIR__ . '/e9826ad19cbc4f5bf20c0913ffcd2ce6'; + putenv('SIMPLESAMLPHP_CONFIG_DIR=' . $invalidDir); + + $this->setExpectedException( + 'InvalidArgumentException', + 'Config directory specified by environment variable SIMPLESAMLPHP_CONFIG_DIR is not a directory. ' . + 'Given: "' . $invalidDir . '"' + ); + + Config::getConfigDir(); + } +}