Skip to content

Commit

Permalink
Move XPath-constants to xml-common
Browse files Browse the repository at this point in the history
  • Loading branch information
tvdijen committed Nov 6, 2024
1 parent 30f5b1c commit 553a9f3
Show file tree
Hide file tree
Showing 12 changed files with 14 additions and 16 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"ext-spl": "*",

"simplesamlphp/assert": "^1.3",
"simplesamlphp/xml-common": "^1.18"
"simplesamlphp/xml-common": "^1.18.5"
},
"require-dev": {
"simplesamlphp/simplesamlphp-test-framework": "^1.7"
Expand Down
2 changes: 0 additions & 2 deletions src/Constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,4 @@ class Constants extends \SimpleSAML\XML\Constants
public const XMLENC_ELEMENT = 'http://www.w3.org/2001/04/xmlenc#Element';
public const XMLENC_ENCRYPTEDKEY = 'http://www.w3.org/2001/04/xmlenc#EncryptedKey';
public const XMLENC_EXI = 'http://www.w3.org/2009/xmlenc11#EXI';

public const XPATH_URI = 'http://www.w3.org/TR/1999/REC-xpath-19991116';
}
2 changes: 1 addition & 1 deletion src/Utils/XML.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public static function processTransforms(
}
}
break;
case C::XPATH_URI:
case C::XPATH10_URI:
$xpath = $transform->getXPath();
if ($xpath !== null) {
$arXPath = [];
Expand Down
6 changes: 3 additions & 3 deletions src/XML/ds/Transform.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ final public function __construct(
if ($xpath !== null) {
Assert::nullOrEq(
$this->algorithm,
C::XPATH_URI,
sprintf('Transform algorithm "%s" required if XPath provided.', C::XPATH_URI),
C::XPATH10_URI,
sprintf('Transform algorithm "%s" required if XPath provided.', C::XPATH10_URI),
);
}

Expand Down Expand Up @@ -135,7 +135,7 @@ public function toXML(DOMElement $parent = null): DOMElement
$e->setAttribute('Algorithm', $algorithm);

switch ($algorithm) {
case C::XPATH_URI:
case C::XPATH10_URI:
$this->getXpath()?->toXML($e);
break;
case C::C14N_EXCLUSIVE_WITH_COMMENTS:
Expand Down
2 changes: 1 addition & 1 deletion tests/XML/ds/RetrievalMethodTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public static function setUpBeforeClass(): void
public function testMarshalling(): void
{
$transforms = new Transforms(
[new Transform(C::XPATH_URI, new XPath('self::xenc:CipherValue[@Id="example1"]', ['xenc' => C::NS_XENC]))],
[new Transform(C::XPATH10_URI, new XPath('self::xenc:CipherValue[@Id="example1"]', ['xenc' => C::NS_XENC]))],
);

$retrievalMethod = new RetrievalMethod($transforms, '#Encrypted_KEY_ID', C:: XMLENC_ENCRYPTEDKEY);
Expand Down
2 changes: 1 addition & 1 deletion tests/XML/ds/TransformTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static function setUpBeforeClass(): void
public function testMarshalling(): void
{
$transform = new Transform(
C::XPATH_URI,
C::XPATH10_URI,
new XPath('count(//. | //@* | //namespace::*)'),
);

Expand Down
2 changes: 1 addition & 1 deletion tests/XML/ds/TransformsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function testMarshalling(): void
$transforms = new Transforms(
[
new Transform(
C::XPATH_URI,
C::XPATH10_URI,
new XPath(
'count(//. | //@* | //namespace::*)',
),
Expand Down
2 changes: 1 addition & 1 deletion tests/XML/xenc/CipherReferenceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public static function setUpBeforeClass(): void
);

$xpath = new XPath('count(//. | //@* | //namespace::*)');
$transform = new Transform(C::XPATH_URI, $xpath);
$transform = new Transform(C::XPATH10_URI, $xpath);
self::$transforms = new Transforms([$transform]);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/XML/xenc/DataReferenceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function testMarshalling(): void
new Transforms(
[
new Transform(
C::XPATH_URI,
C::XPATH10_URI,
new XPath('self::xenc:EncryptedData[@Id="example1"]'),
),
],
Expand Down
2 changes: 1 addition & 1 deletion tests/XML/xenc/KeyReferenceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function testMarshalling(): void
new Transforms(
[
new Transform(
C::XPATH_URI,
C::XPATH10_URI,
new XPath('self::xenc:EncryptedKey[@Id="example1"]'),
),
],
Expand Down
4 changes: 2 additions & 2 deletions tests/XML/xenc/ReferenceListTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ public static function setUpBeforeClass(): void
public function testMarshalling(): void
{
$transformData = new Transform(
C::XPATH_URI,
C::XPATH10_URI,
new XPath('self::xenc:EncryptedData[@Id="example1"]'),
);
$transformKey = new Transform(
C::XPATH_URI,
C::XPATH10_URI,
new XPath('self::xenc:EncryptedKey[@Id="example1"]'),
);

Expand Down
2 changes: 1 addition & 1 deletion tests/XML/xenc/TransformsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function testMarshalling(): void
$transforms = new Transforms(
[
new Transform(
C::XPATH_URI,
C::XPATH10_URI,
new XPath(
'count(//. | //@* | //namespace::*)',
),
Expand Down

0 comments on commit 553a9f3

Please sign in to comment.