summaryrefslogtreecommitdiffstats
path: root/bindings/php5/tests/binding_tests.php
diff options
context:
space:
mode:
Diffstat (limited to 'bindings/php5/tests/binding_tests.php')
-rwxr-xr-xbindings/php5/tests/binding_tests.php68
1 files changed, 65 insertions, 3 deletions
diff --git a/bindings/php5/tests/binding_tests.php b/bindings/php5/tests/binding_tests.php
index e9e48401..d22440ff 100755
--- a/bindings/php5/tests/binding_tests.php
+++ b/bindings/php5/tests/binding_tests.php
@@ -26,7 +26,7 @@ require("../lasso.php");
define("DATA_DIR", "../../../tests/data/");
function test01() {
- echo "Testing lasso_provider_get_organization binding which must return an xmlNode*... ";
+ echo "Get an xmlNode* from a Lasso function... ";
$organisation_string = '<Organization xmlns="urn:liberty:metadata:2003-08">
<OrganizationName>Name of the organization</OrganizationName>
@@ -44,7 +44,7 @@ function test01() {
}
function test02() {
- echo "Get and set a GList of strings... ";
+ echo "Get and set a list of strings... ";
$requestAuthnContext = new LassoLibRequestAuthnContext();
$requestAuthnContext->authnContextClassRef = array(LASSO_LIB_AUTHN_CONTEXT_CLASS_REF_PASSWORD);
@@ -56,7 +56,65 @@ function test02() {
}
function test03() {
- echo "Get and set 'providers' attribute (hashtable) of a server object... ";
+ echo "Get and set a list of xmlNode*...";
+
+ $server = new LassoServer(
+ DATA_DIR . "sp1-la/metadata.xml",
+ DATA_DIR . "sp1-la/private-key-raw.pem",
+ NULL,
+ DATA_DIR . "sp1-la/certificate.pem");
+ $server->addProvider(
+ LASSO_PROVIDER_ROLE_IDP,
+ DATA_DIR . "idp1-la/metadata.xml",
+ DATA_DIR . "idp1-la/public-key.pem",
+ DATA_DIR . "idp1-la/certificate.pem");
+ $login = new LassoLogin($server);
+ $login->initAuthnRequest();
+ $requestAuthnContext = new LassoLibRequestAuthnContext();
+ $extension1 = '<lib:Extension xmlns:lib="urn:liberty:iff:2003-08">
+ <action>do</action>
+</lib:Extension>';
+ $extension2 = '<lib:Extension xmlns:lib="urn:liberty:iff:2003-08">
+ <action2>do action 2</action2><action3>do action 3</action3>
+</lib:Extension>';
+ $extensionList = array($extension1, $extension2);
+ $login->request->extension = $extensionList;
+ assert($login->request->extension == $extensionList);
+ assert($login->request->extension[0] == $extension1);
+ assert($login->request->extension[1] == $extension2);
+
+ echo "OK.\n";
+}
+
+function test04() {
+ echo "Get and set a list of Lasso objects...";
+
+ $response = new LassoSamlpResponse();
+ assert(!$response->assertion);
+
+ $assertions = array();
+ $assertion1 = new LassoSamlAssertion();
+ $assertion1->assertionId = "assertion 1";
+ $assertions[] = $assertion1;
+ assert($assertions[0]->assertionId == "assertion 1");
+ $assertion2 = new LassoSamlAssertion();
+ $assertion2->assertionId = "assertion 2";
+ $assertions[] = $assertion2;
+ $response->assertion = $assertions;
+ assert($response->assertion[0]->assertionId == "assertion 1");
+ assert($response->assertion[1]->assertionId == "assertion 2");
+ unset($assertions);
+ assert($response->assertion[0]->assertionId == "assertion 1");
+ assert($response->assertion[1]->assertionId == "assertion 2");
+ $assertions = $response->assertion;
+ assert($assertions[0]->assertionId == "assertion 1");
+ assert($assertions[1]->assertionId == "assertion 2");
+
+ echo "OK.\n";
+}
+
+function test05() {
+ echo "Get and set a hashtable of objects... ";
$server = new LassoServer(
DATA_DIR . "sp1-la/metadata.xml",
@@ -70,10 +128,12 @@ function test03() {
DATA_DIR . "idp1-la/certificate.pem");
assert(!is_null($server->providers));
assert($server->providers["https://idp1/metadata"]->providerId == "https://idp1/metadata");
+ assert($server->providers["https://idp1/metadata"]->providerId == "https://idp1/metadata");
$tmp_providers = $server->providers;
$server->providers = NULL;
assert(!$server->providers);
$server->providers = $tmp_providers;
+ $provider = $server->providers["https://idp1/metadata"];
assert($server->providers["https://idp1/metadata"]->providerId == "https://idp1/metadata");
echo "OK.\n";
@@ -84,5 +144,7 @@ lasso_init();
test01();
test02();
test03();
+test04();
+//test05();
lasso_shutdown();