-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
285 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace SimpleSAML\WSSecurity\XML\mex; | ||
|
||
use SimpleSAML\WSSecurity\Constants as C; | ||
use SimpleSAML\XML\AbstractElement; | ||
|
||
/** | ||
* Abstract class to be implemented by all the classes in this namespace | ||
* | ||
* @package tvdijen/ws-security | ||
*/ | ||
abstract class AbstractMexElement extends AbstractElement | ||
{ | ||
/** @var string */ | ||
public const NS = C::NS_MEX; | ||
|
||
/** @var string */ | ||
public const NS_PREFIX = 'mex'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace SimpleSAML\WSSecurity\XML\mex; | ||
|
||
use SimpleSAML\XML\URIElementTrait; | ||
|
||
/** | ||
* An Dialect element | ||
* | ||
* @package tvdijen/ws-security | ||
*/ | ||
final class Dialect extends AbstractMexElement | ||
{ | ||
use URIElementTrait; | ||
|
||
|
||
/** | ||
* @param string $content | ||
*/ | ||
public function __construct(string $content) | ||
{ | ||
$this->setContent($content); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace SimpleSAML\WSSecurity\XML\mex; | ||
|
||
use SimpleSAML\XML\URIElementTrait; | ||
|
||
/** | ||
* An Identifier element | ||
* | ||
* @package tvdijen/ws-security | ||
*/ | ||
final class Identifier extends AbstractMexElement | ||
{ | ||
use URIElementTrait; | ||
|
||
|
||
/** | ||
* @param string $content | ||
*/ | ||
public function __construct(string $content) | ||
{ | ||
$this->setContent($content); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace SimpleSAML\WSSecurity\XML\mex; | ||
|
||
use SimpleSAML\XML\URIElementTrait; | ||
|
||
/** | ||
* An Location element | ||
* | ||
* @package tvdijen/ws-security | ||
*/ | ||
final class Location extends AbstractMexElement | ||
{ | ||
use URIElementTrait; | ||
|
||
|
||
/** | ||
* @param string $content | ||
*/ | ||
public function __construct(string $content) | ||
{ | ||
$this->setContent($content); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace SimpleSAML\Test\WSSecurity\XML\mex; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use SimpleSAML\Test\WSSecurity\Constants as C; | ||
use SimpleSAML\WSSecurity\XML\mex\Dialect; | ||
use SimpleSAML\XML\DOMDocumentFactory; | ||
use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; | ||
use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; | ||
|
||
use function dirname; | ||
|
||
/** | ||
* Class \SimpleSAML\WSSecurity\XML\mex\DialectTest | ||
* | ||
* @covers \SimpleSAML\WSSecurity\XML\mex\Dialect | ||
* @covers \SimpleSAML\WSSecurity\XML\wst\AbstractMexElement | ||
* | ||
* @package tvdijen/ws-security | ||
*/ | ||
final class DialectTest extends TestCase | ||
{ | ||
use SchemaValidationTestTrait; | ||
use SerializableElementTestTrait; | ||
|
||
|
||
/** | ||
*/ | ||
public static function setUpBeforeClass(): void | ||
{ | ||
self::$schemaFile = dirname(__FILE__, 5) . '/resources/schemas/MetadataExchange.xsd'; | ||
|
||
self::$testedClass = Dialect::class; | ||
|
||
self::$xmlRepresentation = DOMDocumentFactory::fromFile( | ||
dirname(__FILE__, 4) . '/resources/xml/mex_Dialect.xml', | ||
); | ||
} | ||
|
||
|
||
// test marshalling | ||
|
||
|
||
/** | ||
* Test creating a Dialect object from scratch. | ||
*/ | ||
public function testMarshalling(): void | ||
{ | ||
$dialect = new Dialect(C::NAMESPACE); | ||
|
||
$this->assertEquals( | ||
self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), | ||
strval($dialect), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace SimpleSAML\Test\WSSecurity\XML\mex; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use SimpleSAML\Test\WSSecurity\Constants as C; | ||
use SimpleSAML\WSSecurity\XML\mex\Identifier; | ||
use SimpleSAML\XML\DOMDocumentFactory; | ||
use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; | ||
use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; | ||
|
||
use function dirname; | ||
|
||
/** | ||
* Class \SimpleSAML\WSSecurity\XML\mex\IdentifierTest | ||
* | ||
* @covers \SimpleSAML\WSSecurity\XML\mex\Identifier | ||
* @covers \SimpleSAML\WSSecurity\XML\wst\AbstractMexElement | ||
* | ||
* @package tvdijen/ws-security | ||
*/ | ||
final class IdentifierTest extends TestCase | ||
{ | ||
use SchemaValidationTestTrait; | ||
use SerializableElementTestTrait; | ||
|
||
|
||
/** | ||
*/ | ||
public static function setUpBeforeClass(): void | ||
{ | ||
self::$schemaFile = dirname(__FILE__, 5) . '/resources/schemas/MetadataExchange.xsd'; | ||
|
||
self::$testedClass = Identifier::class; | ||
|
||
self::$xmlRepresentation = DOMDocumentFactory::fromFile( | ||
dirname(__FILE__, 4) . '/resources/xml/mex_Identifier.xml', | ||
); | ||
} | ||
|
||
|
||
// test marshalling | ||
|
||
|
||
/** | ||
* Test creating a Identifier object from scratch. | ||
*/ | ||
public function testMarshalling(): void | ||
{ | ||
$identifier = new Identifier(C::NAMESPACE); | ||
|
||
$this->assertEquals( | ||
self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), | ||
strval($identifier), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace SimpleSAML\Test\WSSecurity\XML\mex; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use SimpleSAML\Test\WSSecurity\Constants as C; | ||
use SimpleSAML\WSSecurity\XML\mex\Location; | ||
use SimpleSAML\XML\DOMDocumentFactory; | ||
use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; | ||
use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; | ||
|
||
use function dirname; | ||
|
||
/** | ||
* Class \SimpleSAML\WSSecurity\XML\mex\LocationTest | ||
* | ||
* @covers \SimpleSAML\WSSecurity\XML\mex\Location | ||
* @covers \SimpleSAML\WSSecurity\XML\wst\AbstractMexElement | ||
* | ||
* @package tvdijen/ws-security | ||
*/ | ||
final class LocationTest extends TestCase | ||
{ | ||
use SchemaValidationTestTrait; | ||
use SerializableElementTestTrait; | ||
|
||
|
||
/** | ||
*/ | ||
public static function setUpBeforeClass(): void | ||
{ | ||
self::$schemaFile = dirname(__FILE__, 5) . '/resources/schemas/MetadataExchange.xsd'; | ||
|
||
self::$testedClass = Location::class; | ||
|
||
self::$xmlRepresentation = DOMDocumentFactory::fromFile( | ||
dirname(__FILE__, 4) . '/resources/xml/mex_Location.xml', | ||
); | ||
} | ||
|
||
|
||
// test marshalling | ||
|
||
|
||
/** | ||
* Test creating a Location object from scratch. | ||
*/ | ||
public function testMarshalling(): void | ||
{ | ||
$location = new Location(C::NAMESPACE); | ||
|
||
$this->assertEquals( | ||
self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), | ||
strval($location), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<mex:Dialect xmlns:mex="http://schemas.xmlsoap.org/ws/2004/09/mex">urn:x-simplesamlphp:namespace</mex:Dialect> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<mex:Identifier xmlns:mex="http://schemas.xmlsoap.org/ws/2004/09/mex">urn:x-simplesamlphp:namespace</mex:Identifier> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<mex:Location xmlns:mex="http://schemas.xmlsoap.org/ws/2004/09/mex">urn:x-simplesamlphp:namespace</mex:Location> |