summaryrefslogtreecommitdiffstats
path: root/bindings/php5/tests
diff options
context:
space:
mode:
authorFrederic Peters <fpeters@entrouvert.com>2008-04-29 12:06:25 +0000
committerFrederic Peters <fpeters@entrouvert.com>2008-04-29 12:06:25 +0000
commit34e4fd0b5aae872344a16267efac847f45108ca7 (patch)
tree904ed6027947636f41f52c6a04ae33507509711e /bindings/php5/tests
parent073b0504389253893c636f40047eb4e0531cec34 (diff)
downloadlasso-34e4fd0b5aae872344a16267efac847f45108ca7.tar.gz
lasso-34e4fd0b5aae872344a16267efac847f45108ca7.tar.xz
lasso-34e4fd0b5aae872344a16267efac847f45108ca7.zip
[project @ fpeters@0d.be-20080118215410-d45drghkhvba7822]
merged Damien branch; and fixed PHP5 binding to use GLib memory management functions Original author: Frederic Peters <fpeters@0d.be> Date: 2008-01-18 22:54:10.239000+01:00
Diffstat (limited to 'bindings/php5/tests')
-rwxr-xr-xbindings/php5/tests/binding_tests.php82
1 files changed, 80 insertions, 2 deletions
diff --git a/bindings/php5/tests/binding_tests.php b/bindings/php5/tests/binding_tests.php
index d22440ff..d4614154 100755
--- a/bindings/php5/tests/binding_tests.php
+++ b/bindings/php5/tests/binding_tests.php
@@ -56,7 +56,7 @@ function test02() {
}
function test03() {
- echo "Get and set a list of xmlNode*...";
+ echo "Get and set a list of xmlNode*... ";
$server = new LassoServer(
DATA_DIR . "sp1-la/metadata.xml",
@@ -87,7 +87,7 @@ function test03() {
}
function test04() {
- echo "Get and set a list of Lasso objects...";
+ echo "Get and set a list of Lasso objects... ";
$response = new LassoSamlpResponse();
assert(!$response->assertion);
@@ -139,6 +139,83 @@ function test05() {
echo "OK.\n";
}
+function test06() {
+ echo "Get and set SAML 2.0 assertion attribute values... ";
+
+ $attribute1_name = "first attribute";
+ $attribute1_string = "first string";
+ $attribute2_name = "second attribute";
+ $attribute2_string = "second string";
+ $attribute3_string = "third string";
+
+ $expected_assertion_dump = '<saml:Assertion xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" SignType="0" SignMethod="0" EncryptionActivated="false" EncryptionSymKeyType="0">
+ <saml:AttributeStatement>
+ <saml:Attribute Name="first attribute">
+ <saml:AttributeValue>
+ <XXX>first string</XXX>
+ </saml:AttributeValue>
+ </saml:Attribute>
+ <saml:Attribute Name="second attribute">
+ <saml:AttributeValue>
+ <XXX>second string</XXX>
+ </saml:AttributeValue>
+ <saml:AttributeValue>
+ <XXX>third string</XXX>
+ </saml:AttributeValue>
+ </saml:Attribute>
+ </saml:AttributeStatement>
+</saml:Assertion>';
+
+ $text_node1 = new LassoMiscTextNode();
+ $text_node1->content = $attribute1_string;
+ $any1 = array();
+ $any1[] = $text_node1;
+ $attribute_value1 = new LassoSaml2AttributeValue();
+ $attribute_value1->any = $any1;
+ $attribute_values1 = array();
+ $attribute_values1[] = $attribute_value1;
+ $attribute1 = new LassoSaml2Attribute();
+ $attribute1->name = $attribute1_name;
+ $attribute1->attributeValue = $attribute_values1;
+
+ $text_node2 = new LassoMiscTextNode();
+ $text_node2->content = $attribute2_string;
+ $any2 = array();
+ $any2[] = $text_node2;
+ $attribute_value2 = new LassoSaml2AttributeValue();
+ $attribute_value2->any = $any2;
+
+ $text_node3 = new LassoMiscTextNode();
+ $text_node3->content = $attribute3_string;
+ $any3 = array();
+ $any3[] = $text_node3;
+ $attribute_value3 = new LassoSaml2AttributeValue();
+ $attribute_value3->any = $any3;
+
+ $attribute_values2 = array();
+ $attribute_values2[] = $attribute_value2;
+ $attribute_values2[] = $attribute_value3;
+
+ $attribute2 = new LassoSaml2Attribute();
+ $attribute2->name = $attribute2_name;
+ $attribute2->attributeValue = $attribute_values2;
+
+ $attributes = array();
+ $attributes[] = $attribute1;
+ $attributes[] = $attribute2;
+
+ $attributeStatement = new LassoSaml2AttributeStatement();
+ $attributeStatement->attribute = $attributes;
+ $attributeStatements = array();
+ $attributeStatements[] = $attributeStatement;
+
+ $assertion = new LassoSaml2Assertion();
+ $assertion->attributeStatement = $attributeStatements;
+
+ assert($assertion->dump() == $expected_assertion_dump);
+
+ echo "OK.\n";
+}
lasso_init();
test01();
@@ -146,5 +223,6 @@ test02();
test03();
test04();
//test05();
+test06();
lasso_shutdown();