Skip to content

Commit 0d43197

Browse files
committed
Make sure all XML-classes have a marshalling/unmarshalling test
1 parent 4fa17d2 commit 0d43197

17 files changed

Lines changed: 145 additions & 458 deletions

tests/SAML2/XML/md/RoleDescriptorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ public function testMarshalling(): void
154154
/**
155155
* Test unmarshalling a known object as a RoleDescriptor.
156156
*/
157-
public function testUnmarshallingRegistered(): void
157+
public function testUnmarshalling(): void
158158
{
159159
$descriptor = AbstractRoleDescriptor::fromXML(self::$xmlRepresentation->documentElement);
160160

tests/SAML2/XML/saml/AttributeStatementTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public static function setUpBeforeClass(): void
4949

5050
/**
5151
*/
52-
public function testMarshallingAttributes(): void
52+
public function testMarshalling(): void
5353
{
5454
$attrStatement = new AttributeStatement(
5555
[

tests/SAML2/XML/saml/AttributeValueTest.php

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -45,36 +45,37 @@ public static function setUpBeforeClass(): void
4545
// marshalling
4646

4747

48-
/**
49-
* Test creating an AttributeValue from scratch using a string.
50-
*
51-
*/
52-
public function testMarshallingString(): void
53-
{
54-
$av = new AttributeValue('value');
55-
56-
$this->assertEquals('value', $av->getValue());
57-
$this->assertEquals('xs:string', $av->getXsiType());
58-
}
59-
60-
6148
/**
6249
* Test creating an AttributeValue from scratch using an integer.
63-
*
6450
*/
65-
public function testMarshallingInteger(): void
51+
public function testMarshalling(): void
6652
{
6753
$av = new AttributeValue(2);
6854
$this->assertIsInt($av->getValue());
6955
$this->assertEquals(2, $av->getValue());
7056
$this->assertEquals('xs:integer', $av->getXsiType());
57+
7158
$this->assertEquals(
7259
self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
7360
strval($av),
7461
);
7562
}
7663

7764

65+
/**
66+
* Test creating an AttributeValue from scratch using a string.
67+
*/
68+
public function testMarshallingString(): void
69+
{
70+
$av = new AttributeValue('value');
71+
72+
$this->assertEquals('value', $av->getValue());
73+
$this->assertEquals('xs:string', $av->getXsiType());
74+
}
75+
76+
77+
/**
78+
*/
7879
public function testMarshallingNull(): void
7980
{
8081
$av = new AttributeValue(null);
@@ -124,6 +125,7 @@ public function testUnmarshalling(): void
124125

125126
$this->assertIsInt($av->getValue());
126127
$this->assertEquals(2, $av->getValue());
128+
127129
$this->assertEquals(
128130
self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
129131
strval($av),

tests/SAML2/XML/saml/BaseIDTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,9 @@ public function testMarshalling(): void
7777

7878

7979
/**
80+
* Test unmarshalling a registered class
8081
*/
81-
public function testUnmarshallingRegistered(): void
82+
public function testUnmarshalling(): void
8283
{
8384
$baseId = AbstractBaseID::fromXML(self::$xmlRepresentation->documentElement);
8485

tests/SAML2/XML/saml/ConditionTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,9 @@ public function testMarshalling(): void
7474

7575

7676
/**
77+
* Test unmarshalling a registered class
7778
*/
78-
public function testUnmarshallingRegistered(): void
79+
public function testUnmarshalling(): void
7980
{
8081
$condition = CustomCondition::fromXML(self::$xmlRepresentation->documentElement);
8182

tests/SAML2/XML/saml/EncryptedAssertionTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,19 @@ public function testMarshalling(): void
104104
}
105105

106106

107+
/**
108+
*/
109+
public function testUnmarshalling(): void
110+
{
111+
$encryptedAssertion = EncryptedAssertion::fromXML(self::$xmlRepresentation->documentElement);
112+
113+
$this->assertEquals(
114+
self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
115+
strval($encryptedAssertion),
116+
);
117+
}
118+
119+
107120
/**
108121
* Test encryption / decryption
109122
*/

tests/SAML2/XML/saml/EncryptedIDTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,19 @@ public function testMarshallingElementOrdering(): void
161161
}
162162

163163

164+
/**
165+
*/
166+
public function testUnmarshalling(): void
167+
{
168+
$eid = EncryptedID::fromXML(self::$xmlRepresentation->documentElement);
169+
170+
$this->assertEquals(
171+
self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
172+
strval($eid),
173+
);
174+
}
175+
176+
164177
/**
165178
* Test encryption / decryption
166179
*/

tests/SAML2/XML/saml/StatementTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,9 @@ public function testMarshalling(): void
7575

7676

7777
/**
78+
* Test unmarshalling a registered class
7879
*/
79-
public function testUnmarshallingRegistered(): void
80+
public function testUnmarshalling(): void
8081
{
8182
$statement = CustomStatement::fromXML(self::$xmlRepresentation->documentElement);
8283
$this->assertInstanceOf(CustomStatement::class, $statement);

tests/SAML2/XML/saml/SubjectTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public function setup(): void
8787

8888
/**
8989
*/
90-
public function testMarshallingNameID(): void
90+
public function testMarshalling(): void
9191
{
9292
$arbitrary = DOMDocumentFactory::fromString('<some>Arbitrary Element</some>');
9393

0 commit comments

Comments
 (0)