Skip to content

Commit

Permalink
Implement generic version of testUnmarshalling
Browse files Browse the repository at this point in the history
  • Loading branch information
tvdijen committed Dec 26, 2023
1 parent ff512ea commit 698d02b
Show file tree
Hide file tree
Showing 119 changed files with 1 addition and 1,685 deletions.
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -31,7 +31,7 @@
"psr/http-message": "^2.0",
"psr/log": "^2.0 || ^3.0",
"simplesamlphp/assert": "^1.0",
"simplesamlphp/xml-common": "^1.12",
"simplesamlphp/xml-common": "^1.14",
"simplesamlphp/xml-security": "^1.6",
"simplesamlphp/xml-soap": "^1.3"
},
Expand Down
13 changes: 0 additions & 13 deletions tests/SAML2/XML/alg/DigestMethodTest.php
Expand Up @@ -67,19 +67,6 @@ public function testMarshalling(): void
}


/**
*/
public function testUnmarshalling(): void
{
$digestMethod = DigestMethod::fromXML(self::$xmlRepresentation->documentElement);

$this->assertEquals(
self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
strval($digestMethod),
);
}


/**
*/
public function testUnmarshallingMissingAlgorithmThrowsException(): void
Expand Down
13 changes: 0 additions & 13 deletions tests/SAML2/XML/alg/SigningMethodTest.php
Expand Up @@ -69,19 +69,6 @@ public function testMarshalling(): void
}


/**
*/
public function testUnmarshalling(): void
{
$signingMethod = SigningMethod::fromXML(self::$xmlRepresentation->documentElement);

$this->assertEquals(
self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
strval($signingMethod),
);
}


/**
*/
public function testMissingAlgorithmThrowsException(): void
Expand Down
13 changes: 0 additions & 13 deletions tests/SAML2/XML/ecp/RelayStateTest.php
Expand Up @@ -59,19 +59,6 @@ public function testMarshalling(): void
}


/**
*/
public function testUnmarshalling(): void
{
$relayState = RelayState::fromXML(self::$xmlRepresentation->documentElement);

$this->assertEquals(
self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
strval($relayState),
);
}


/**
*/
public function testUnmarshallingWithMissingMustUnderstandThrowsException(): void
Expand Down
13 changes: 0 additions & 13 deletions tests/SAML2/XML/ecp/RequestAuthenticatedTest.php
Expand Up @@ -54,19 +54,6 @@ public function testMarshalling(): void
}


/**
*/
public function testUnmarshalling(): void
{
$ra = RequestAuthenticated::fromXML(self::$xmlRepresentation->documentElement);

$this->assertEquals(
self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
strval($ra),
);
}


/**
*/
public function testUnmarshallingWithMissingActorThrowsException(): void
Expand Down
13 changes: 0 additions & 13 deletions tests/SAML2/XML/ecp/RequestTest.php
Expand Up @@ -75,19 +75,6 @@ public function testMarshalling(): void
}


/**
*/
public function testUnmarshalling(): void
{
$request = Request::fromXML(self::$xmlRepresentation->documentElement);

$this->assertEquals(
self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
strval($request),
);
}


/**
*/
public function testUnmarshallingWithMissingMustUnderstandThrowsException(): void
Expand Down
13 changes: 0 additions & 13 deletions tests/SAML2/XML/ecp/ResponseTest.php
Expand Up @@ -85,19 +85,6 @@ public function testInvalidACSThrowsException(): void
}


/**
*/
public function testUnmarshalling(): void
{
$response = Response::fromXML(self::$xmlRepresentation->documentElement);

$this->assertEquals(
self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
strval($response),
);
}


/**
*/
public function testUnmarshallingWithMissingMustUnderstandThrowsException(): void
Expand Down
13 changes: 0 additions & 13 deletions tests/SAML2/XML/ecp/SubjectConfirmationTest.php
Expand Up @@ -82,19 +82,6 @@ public function testMarshalling(): void
}


/**
*/
public function testUnmarshalling(): void
{
$subjectConfirmation = SubjectConfirmation::fromXML(self::$xmlRepresentation->documentElement);

$this->assertEquals(
self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
strval($subjectConfirmation),
);
}


/**
*/
public function testUnmarshallingWithMissingMustUnderstandThrowsException(): void
Expand Down
14 changes: 0 additions & 14 deletions tests/SAML2/XML/emd/RepublishRequestTest.php
Expand Up @@ -62,18 +62,4 @@ public function testMarshalling(): void
strval($republishRequest),
);
}


/**
* Unmarshalling
*/
public function testUnmarshalling(): void
{
$republishRequest = RepublishRequest::fromXML(self::$xmlRepresentation->documentElement);

$this->assertEquals(
self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
strval($republishRequest),
);
}
}
11 changes: 0 additions & 11 deletions tests/SAML2/XML/emd/RepublishTargetTest.php
Expand Up @@ -63,15 +63,4 @@ public function testMarshallingIncorrectValueThrowsException(): void

new RepublishTarget('http://example.org/');
}


/**
* Unmarshalling
*/
public function testUnmarshalling(): void
{
$republishTarget = RepublishTarget::fromXML(self::$xmlRepresentation->documentElement);

$this->assertEquals('http://edugain.org/', $republishTarget->getContent());
}
}
14 changes: 0 additions & 14 deletions tests/SAML2/XML/idpdisc/DiscoveryResponseTest.php
Expand Up @@ -119,20 +119,6 @@ public function testMarshallingWithResponseLocation(): void
// test unmarshalling


/**
* Test creating a DiscoveryResponse from XML.
*/
public function testUnmarshalling(): void
{
$discoResponse = DiscoveryResponse::fromXML(self::$xmlRepresentation->documentElement);

$this->assertEquals(
self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
strval($discoResponse),
);
}


/**
* Test that creating a DiscoveryResponse from XML fails when ResponseLocation is present.
*/
Expand Down
14 changes: 0 additions & 14 deletions tests/SAML2/XML/init/RequestInitiatorTest.php
Expand Up @@ -75,20 +75,6 @@ public function testMarshalling(): void
// test unmarshalling


/**
* Test creating a RequestInitiator from XML.
*/
public function testUnmarshalling(): void
{
$requestInitiator = RequestInitiator::fromXML(self::$xmlRepresentation->documentElement);

$this->assertEquals(
self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
strval($requestInitiator),
);
}


/**
* Test that creating a RequestInitiator from XML with an invalid Binding fails.
*/
Expand Down
14 changes: 0 additions & 14 deletions tests/SAML2/XML/md/AdditionalMetadataLocationTest.php
Expand Up @@ -75,20 +75,6 @@ public function testMarshallingWithEmptyNamespace(): void
// test unmarshalling


/**
* Test creating an AdditionalMetadataLocation object from XML.
*/
public function testUnmarshalling(): void
{
$additionalMetadataLocation = AdditionalMetadataLocation::fromXML(self::$xmlRepresentation->documentElement);

$this->assertEquals(
self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
strval($additionalMetadataLocation),
);
}


/**
* Test that creating an AdditionalMetadataLocation from XML fails if "namespace" is missing.
*/
Expand Down
17 changes: 0 additions & 17 deletions tests/SAML2/XML/md/AffiliateMemberTest.php
Expand Up @@ -84,21 +84,4 @@ public function testMarshallingTooLongContentThrowsException(): void

new AffiliateMember(str_pad('https://some.entity.org/id', C::ENTITYID_MAX_LENGTH + 1, 'a'));
}


// test unmarshalling


/**
* Test creating a AffiliateMember from XML.
*/
public function testUnmarshalling(): void
{
$affiliateMember = AffiliateMember::fromXML(self::$xmlRepresentation->documentElement);

$this->assertEquals(
self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
strval($affiliateMember),
);
}
}
14 changes: 0 additions & 14 deletions tests/SAML2/XML/md/AffiliationDescriptorTest.php
Expand Up @@ -120,20 +120,6 @@ public function testMarshallingWithEmptyMemberList(): void
// test unmarshalling


/**
* Test creating an AffiliationDescriptor from XML.
*/
public function testUnmarshalling(): void
{
$affiliationDescriptor = AffiliationDescriptor::fromXML(self::$xmlRepresentation->documentElement);

$this->assertEquals(
self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
strval($affiliationDescriptor),
);
}


/**
* Test failure to create an AffiliationDescriptor from XML when there's no affiliation members.
*/
Expand Down
14 changes: 0 additions & 14 deletions tests/SAML2/XML/md/ArtifactResolutionServiceTest.php
Expand Up @@ -111,20 +111,6 @@ public function testMarshallingWithResponseLocation(): void
// test unmarshalling


/**
* Test creating a ArtifactResolutionService from XML.
*/
public function testUnmarshalling(): void
{
$ars = ArtifactResolutionService::fromXML(self::$xmlRepresentation->documentElement);

$this->assertEquals(
self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
strval($ars),
);
}


/**
* Test that creating a ArtifactResolutionService from XML fails when ResponseLocation is present.
*/
Expand Down
17 changes: 0 additions & 17 deletions tests/SAML2/XML/md/AssertionConsumerServiceTest.php
Expand Up @@ -94,21 +94,4 @@ public function testMarshalling(): void
strval($idxep),
);
}


// test unmarshalling


/**
* Test creating an IndexedEndpointType from XML.
*/
public function testUnmarshalling(): void
{
$idxep = AssertionConsumerService::fromXML(self::$xmlRepresentation->documentElement);

$this->assertEquals(
self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
strval($idxep),
);
}
}
14 changes: 0 additions & 14 deletions tests/SAML2/XML/md/AttributeAuthorityDescriptorTest.php
Expand Up @@ -275,20 +275,6 @@ public function testMarshallingWithWrongAttribute(): void
// test unmarshalling


/**
* Test creating an AttributeAuthorityDescriptor from XML
*/
public function testUnmarshalling(): void
{
$aad = AttributeAuthorityDescriptor::fromXML(self::$xmlRepresentation->documentElement);

$this->assertEquals(
self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
strval($aad),
);
}


/**
* Test that creating an AttributeAuthorityDescriptor without any optional element works.
*/
Expand Down
14 changes: 0 additions & 14 deletions tests/SAML2/XML/md/AttributeConsumingServiceTest.php
Expand Up @@ -171,20 +171,6 @@ public function testMarshallingWithEmptyRequestedAttributes(): void
// test unmarshalling


/**
* Test creating an AssertionConsumerService from XML.
*/
public function testUnmarshalling(): void
{
$acs = AttributeConsumingService::fromXML(self::$xmlRepresentation->documentElement);

$this->assertEquals(
self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
strval($acs),
);
}


/**
* Test that creating an AssertionConsumerService from XML fails if index is missing.
*/
Expand Down
16 changes: 0 additions & 16 deletions tests/SAML2/XML/md/AttributeProfileTest.php
Expand Up @@ -58,20 +58,4 @@ public function testMarshalling(): void
strval($attributeProfile),
);
}


// unmarshalling


/**
*/
public function testUnmarshalling(): void
{
$attributeProfile = AttributeProfile::fromXML(self::$xmlRepresentation->documentElement);

$this->assertEquals(
self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
strval($attributeProfile),
);
}
}

0 comments on commit 698d02b

Please sign in to comment.