Skip to content

Commit 2f3d7dc

Browse files
committed
Use shorthand instantiation for typed textcontent types
1 parent f62d44d commit 2f3d7dc

5 files changed

Lines changed: 13 additions & 33 deletions

File tree

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
"ext-spl": "*",
1616

1717
"simplesamlphp/assert": "~1.9",
18-
"simplesamlphp/xml-common": "~2.5",
19-
"simplesamlphp/xml-security": "~2.1",
20-
"simplesamlphp/xml-soap": "~2.1"
18+
"simplesamlphp/xml-common": "~2.6",
19+
"simplesamlphp/xml-security": "~2.2"
2120
},
2221
"require-dev": {
23-
"simplesamlphp/simplesamlphp-test-framework": "~1.11"
22+
"simplesamlphp/simplesamlphp-test-framework": "~1.11",
23+
"simplesamlphp/xml-soap": "~2.2"
2424
},
2525
"autoload": {
2626
"psr-4": {

tests/Security/XML/wsse/SecurityTest.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
use SimpleSAML\XMLSchema\Type\Base64BinaryValue;
2323
use SimpleSAML\XMLSchema\Type\StringValue;
2424
use SimpleSAML\XMLSecurity\Constants as C;
25-
use SimpleSAML\XMLSecurity\Type\DigestValue as DigestValueType;
2625
use SimpleSAML\XMLSecurity\XML\ds\CanonicalizationMethod;
2726
use SimpleSAML\XMLSecurity\XML\ds\DigestMethod;
2827
use SimpleSAML\XMLSecurity\XML\ds\DigestValue;
@@ -96,16 +95,12 @@ public function testMarshalling(): void
9695

9796
$signature = new Signature(
9897
new SignedInfo(
99-
new CanonicalizationMethod(
100-
AnyURIValue::fromString(C::C14N_EXCLUSIVE_WITHOUT_COMMENTS),
101-
),
102-
new SignatureMethod(
103-
AnyURIValue::fromString(C::SIG_RSA_SHA256),
104-
),
98+
new CanonicalizationMethod(AnyURIValue::fromString(C::C14N_EXCLUSIVE_WITHOUT_COMMENTS)),
99+
new SignatureMethod(AnyURIValue::fromString(C::SIG_RSA_SHA256)),
105100
[
106101
new DSReference(
107102
new DigestMethod(AnyURIValue::fromString(C::DIGEST_SHA256)),
108-
new DigestValue(DigestValueType::fromString($content)),
103+
DigestValue::fromString($content),
109104
null,
110105
null,
111106
null,

tests/Security/XML/wsse11/EncryptedHeaderTest.php

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait;
1717
use SimpleSAML\XML\TestUtils\SerializableElementTestTrait;
1818
use SimpleSAML\XMLSchema\Type\AnyURIValue;
19-
use SimpleSAML\XMLSchema\Type\Base64BinaryValue;
2019
use SimpleSAML\XMLSchema\Type\IDValue as BaseIDValue;
2120
use SimpleSAML\XMLSchema\Type\StringValue;
2221
use SimpleSAML\XMLSecurity\Constants as C;
@@ -69,34 +68,26 @@ public function testMarshalling(): void
6968

7069
$encryptedData = new EncryptedData(
7170
new CipherData(
72-
new CipherValue(
73-
Base64BinaryValue::fromString('/CTj03d1DB5e2t7CTo9BEzCf5S9NRzwnBgZRlm32REI='),
74-
),
71+
CipherValue::fromString('/CTj03d1DB5e2t7CTo9BEzCf5S9NRzwnBgZRlm32REI='),
7572
),
7673
BaseIDValue::fromString('MyID'),
7774
AnyURIValue::fromString(C::XMLENC_ELEMENT),
7875
StringValue::fromString('text/plain'),
7976
AnyURIValue::fromString('urn:x-simplesamlphp:encoding'),
80-
new EncryptionMethod(
81-
AnyURIValue::fromString(C::BLOCK_ENC_AES128),
82-
),
77+
new EncryptionMethod(AnyURIValue::fromString(C::BLOCK_ENC_AES128)),
8378
new KeyInfo(
8479
[
8580
new EncryptedKey(
8681
new CipherData(
87-
new CipherValue(
88-
Base64BinaryValue::fromString('/CTj03d1DB5e2t7CTo9BEzCf5S9NRzwnBgZRlm32REI='),
89-
),
82+
CipherValue::fromString('/CTj03d1DB5e2t7CTo9BEzCf5S9NRzwnBgZRlm32REI='),
9083
),
9184
null,
9285
null,
9386
null,
9487
null,
9588
null,
9689
null,
97-
new EncryptionMethod(
98-
AnyURIValue::fromString(C::SIG_RSA_SHA256),
99-
),
90+
new EncryptionMethod(AnyURIValue::fromString(C::SIG_RSA_SHA256)),
10091
),
10192
],
10293
),

tests/Security/XML/wsse11/IterationTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
use SimpleSAML\XML\DOMDocumentFactory;
1313
use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait;
1414
use SimpleSAML\XML\TestUtils\SerializableElementTestTrait;
15-
use SimpleSAML\XMLSchema\Type\UnsignedIntValue;
1615

1716
use function dirname;
1817
use function strval;
@@ -51,9 +50,7 @@ public static function setUpBeforeClass(): void
5150
*/
5251
public function testMarshalling(): void
5352
{
54-
$iteration = new Iteration(
55-
UnsignedIntValue::fromInteger(5),
56-
);
53+
$iteration = Iteration::fromString('5');
5754

5855
$this->assertEquals(
5956
self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),

tests/Security/XML/wsse11/SaltTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
use SimpleSAML\XML\DOMDocumentFactory;
1313
use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait;
1414
use SimpleSAML\XML\TestUtils\SerializableElementTestTrait;
15-
use SimpleSAML\XMLSchema\Type\Base64BinaryValue;
1615

1716
use function dirname;
1817
use function strval;
@@ -53,9 +52,7 @@ public function testMarshalling(): void
5352
{
5453
$content = 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=';
5554

56-
$salt = new Salt(
57-
Base64BinaryValue::fromString($content),
58-
);
55+
$salt = Salt::fromString($content);
5956

6057
$this->assertEquals(
6158
self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),

0 commit comments

Comments
 (0)