Skip to content

Commit 9c3ddcf

Browse files
committed
Use shorthand instantiation for typed textcontent types
1 parent fd0efc6 commit 9c3ddcf

19 files changed

Lines changed: 48 additions & 59 deletions

tests/SecurityPolicy/XML/sp_200507/EncryptedElementsTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public static function setUpBeforeClass(): void
5454
*/
5555
public function testMarshallingElementOrdering(): void
5656
{
57-
$xpath = new XPath(StringValue::fromString('/bookstore/book[price>35.00]/title'));
57+
$xpath = XPath::fromString('/bookstore/book[price>35.00]/title');
5858
$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1'));
5959
$chunk = new Chunk(DOMDocumentFactory::fromString(
6060
'<ssp:Chunk xmlns:ssp="urn:x-simplesamlphp:namespace">some</ssp:Chunk>',
@@ -94,7 +94,7 @@ public function testMarshallingElementOrdering(): void
9494
*/
9595
public function testMarshalling(): void
9696
{
97-
$xpath = new XPath(StringValue::fromString('/bookstore/book[price>35.00]/title'));
97+
$xpath = XPath::fromString('/bookstore/book[price>35.00]/title');
9898
$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1'));
9999
$chunk = new Chunk(DOMDocumentFactory::fromString(
100100
'<ssp:Chunk xmlns:ssp="urn:x-simplesamlphp:namespace">some</ssp:Chunk>',

tests/SecurityPolicy/XML/sp_200507/IssuedTokenTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
use SimpleSAML\WebServices\SecurityPolicy\XML\sp_200507\AbstractIssuedTokenType;
1818
use SimpleSAML\WebServices\SecurityPolicy\XML\sp_200507\AbstractSpElement;
1919
use SimpleSAML\WebServices\SecurityPolicy\XML\sp_200507\IncludeToken;
20-
use SimpleSAML\WebServices\SecurityPolicy\XML\sp_200507\IncludeTokenTypeTrait;
2120
use SimpleSAML\WebServices\SecurityPolicy\XML\sp_200507\IssuedToken;
2221
use SimpleSAML\WebServices\SecurityPolicy\XML\sp_200507\Issuer;
2322
use SimpleSAML\WebServices\SecurityPolicy\XML\sp_200507\RequestSecurityTokenTemplate;
@@ -41,7 +40,6 @@
4140
*/
4241
#[Group('sp')]
4342
#[CoversClass(IssuedToken::class)]
44-
#[CoversClass(IncludeTokenTypeTrait::class)]
4543
#[CoversClass(AbstractIssuedTokenType::class)]
4644
#[CoversClass(AbstractSpElement::class)]
4745
final class IssuedTokenTest extends TestCase

tests/SecurityPolicy/XML/sp_200507/RequestSecurityTokenTemplateTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,15 @@ public function testMarshalling(): void
5959
'<ssp:Chunk xmlns:ssp="urn:x-simplesamlphp:namespace">some</ssp:Chunk>',
6060
)->documentElement);
6161

62-
$RequestSecurityTokenTemplateElements = new RequestSecurityTokenTemplate(
62+
$requestSecurityTokenTemplateElements = new RequestSecurityTokenTemplate(
6363
AnyURIValue::fromString('urn:x-simplesamlphp:version'),
6464
[$chunk],
6565
[$attr],
6666
);
6767

6868
$this->assertEquals(
6969
self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
70-
strval($RequestSecurityTokenTemplateElements),
70+
strval($requestSecurityTokenTemplateElements),
7171
);
7272
}
7373

@@ -78,11 +78,11 @@ public function testMarshalling(): void
7878
public function testMarshallingEmptyElement(): void
7979
{
8080
$spns = C::NS_SEC_POLICY_11;
81-
$RequestSecurityTokenTemplate = new RequestSecurityTokenTemplate();
81+
$requestSecurityTokenTemplate = new RequestSecurityTokenTemplate();
8282
$this->assertEquals(
8383
"<sp:RequestSecurityTokenTemplate xmlns:sp=\"$spns\"/>",
84-
strval($RequestSecurityTokenTemplate),
84+
strval($requestSecurityTokenTemplate),
8585
);
86-
$this->assertTrue($RequestSecurityTokenTemplate->isEmptyElement());
86+
$this->assertTrue($requestSecurityTokenTemplate->isEmptyElement());
8787
}
8888
}

tests/SecurityPolicy/XML/sp_200507/RequiredElementsTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public static function setUpBeforeClass(): void
5454
*/
5555
public function testMarshallingElementOrdering(): void
5656
{
57-
$xpath = new XPath(StringValue::fromString('/bookstore/book[price>35.00]/title'));
57+
$xpath = XPath::fromString('/bookstore/book[price>35.00]/title');
5858
$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1'));
5959
$chunk = new Chunk(DOMDocumentFactory::fromString(
6060
'<ssp:Chunk xmlns:ssp="urn:x-simplesamlphp:namespace">some</ssp:Chunk>',
@@ -94,7 +94,7 @@ public function testMarshallingElementOrdering(): void
9494
*/
9595
public function testMarshalling(): void
9696
{
97-
$xpath = new XPath(StringValue::fromString('/bookstore/book[price>35.00]/title'));
97+
$xpath = XPath::fromString('/bookstore/book[price>35.00]/title');
9898
$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1'));
9999
$chunk = new Chunk(DOMDocumentFactory::fromString(
100100
'<ssp:Chunk xmlns:ssp="urn:x-simplesamlphp:namespace">some</ssp:Chunk>',

tests/SecurityPolicy/XML/sp_200507/SamlTokenTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ public static function setUpBeforeClass(): void
5858
public function testMarshallingEmptyElement(): void
5959
{
6060
$spns = C::NS_SEC_POLICY_11;
61-
$SamlToken = new SamlToken();
61+
$samlToken = new SamlToken();
6262
$this->assertEquals(
6363
"<sp:SamlToken xmlns:sp=\"$spns\"/>",
64-
strval($SamlToken),
64+
strval($samlToken),
6565
);
66-
$this->assertTrue($SamlToken->isEmptyElement());
66+
$this->assertTrue($samlToken->isEmptyElement());
6767
}
6868

6969

@@ -78,10 +78,10 @@ public function testMarshalling(): void
7878
'<ssp:Chunk xmlns:ssp="urn:x-simplesamlphp:namespace">some</ssp:Chunk>',
7979
)->documentElement);
8080

81-
$SamlToken = new SamlToken([$chunk], [$includeToken->toAttribute(), $attr]);
81+
$samlToken = new SamlToken([$chunk], [$includeToken->toAttribute(), $attr]);
8282
$this->assertEquals(
8383
self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
84-
strval($SamlToken),
84+
strval($samlToken),
8585
);
8686
}
8787
}

tests/SecurityPolicy/XML/sp_200507/SignedElementsTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public static function setUpBeforeClass(): void
5454
*/
5555
public function testMarshallingElementOrdering(): void
5656
{
57-
$xpath = new XPath(StringValue::fromString('/bookstore/book[price>35.00]/title'));
57+
$xpath = XPath::fromString('/bookstore/book[price>35.00]/title');
5858
$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1'));
5959
$chunk = new Chunk(DOMDocumentFactory::fromString(
6060
'<ssp:Chunk xmlns:ssp="urn:x-simplesamlphp:namespace">some</ssp:Chunk>',
@@ -94,7 +94,7 @@ public function testMarshallingElementOrdering(): void
9494
*/
9595
public function testMarshalling(): void
9696
{
97-
$xpath = new XPath(StringValue::fromString('/bookstore/book[price>35.00]/title'));
97+
$xpath = XPath::fromString('/bookstore/book[price>35.00]/title');
9898
$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1'));
9999
$chunk = new Chunk(DOMDocumentFactory::fromString(
100100
'<ssp:Chunk xmlns:ssp="urn:x-simplesamlphp:namespace">some</ssp:Chunk>',

tests/SecurityPolicy/XML/sp_200507/UsernameTokenTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ public static function setUpBeforeClass(): void
5858
public function testMarshallingEmptyElement(): void
5959
{
6060
$spns = C::NS_SEC_POLICY_11;
61-
$UsernameToken = new UsernameToken();
61+
$usernameToken = new UsernameToken();
6262
$this->assertEquals(
6363
"<sp:UsernameToken xmlns:sp=\"$spns\"/>",
64-
strval($UsernameToken),
64+
strval($usernameToken),
6565
);
66-
$this->assertTrue($UsernameToken->isEmptyElement());
66+
$this->assertTrue($usernameToken->isEmptyElement());
6767
}
6868

6969

@@ -78,10 +78,10 @@ public function testMarshalling(): void
7878
'<ssp:Chunk xmlns:ssp="urn:x-simplesamlphp:namespace">some</ssp:Chunk>',
7979
)->documentElement);
8080

81-
$UsernameToken = new UsernameToken([$chunk], [$includeToken->toAttribute(), $attr]);
81+
$usernameToken = new UsernameToken([$chunk], [$includeToken->toAttribute(), $attr]);
8282
$this->assertEquals(
8383
self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
84-
strval($UsernameToken),
84+
strval($usernameToken),
8585
);
8686
}
8787
}

tests/SecurityPolicy/XML/sp_200507/X509TokenTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ public static function setUpBeforeClass(): void
5858
public function testMarshallingEmptyElement(): void
5959
{
6060
$spns = C::NS_SEC_POLICY_11;
61-
$X509Token = new X509Token();
61+
$x509Token = new X509Token();
6262
$this->assertEquals(
6363
"<sp:X509Token xmlns:sp=\"$spns\"/>",
64-
strval($X509Token),
64+
strval($x509Token),
6565
);
66-
$this->assertTrue($X509Token->isEmptyElement());
66+
$this->assertTrue($x509Token->isEmptyElement());
6767
}
6868

6969

@@ -78,10 +78,10 @@ public function testMarshalling(): void
7878
'<ssp:Chunk xmlns:ssp="urn:x-simplesamlphp:namespace">some</ssp:Chunk>',
7979
)->documentElement);
8080

81-
$X509Token = new X509Token([$chunk], [$includeToken->toAttribute(), $attr]);
81+
$x509Token = new X509Token([$chunk], [$includeToken->toAttribute(), $attr]);
8282
$this->assertEquals(
8383
self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),
84-
strval($X509Token),
84+
strval($x509Token),
8585
);
8686
}
8787
}

tests/SecurityPolicy/XML/sp_200507/XPathTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
use SimpleSAML\WebServices\SecurityPolicy\XML\sp_200507\XPath;
1212
use SimpleSAML\XML\DOMDocumentFactory;
1313
use SimpleSAML\XML\TestUtils\SerializableElementTestTrait;
14-
use SimpleSAML\XMLSchema\Type\StringValue;
1514

1615
use function dirname;
1716
use function strval;
@@ -49,7 +48,7 @@ public static function setUpBeforeClass(): void
4948
*/
5049
public function testMarshalling(): void
5150
{
52-
$xpath = new XPath(StringValue::fromString('/bookstore/book[price>35.00]/title'));
51+
$xpath = XPath::fromString('/bookstore/book[price>35.00]/title');
5352

5453
$this->assertEquals(
5554
self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement),

tests/SecurityPolicy/XML/sp_200702/ContentEncryptedElementsTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public static function setUpBeforeClass(): void
5454
*/
5555
public function testMarshallingElementOrdering(): void
5656
{
57-
$xpath = new XPath(StringValue::fromString('/bookstore/book[price>35.00]/title'));
57+
$xpath = XPath::fromString('/bookstore/book[price>35.00]/title');
5858
$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1'));
5959
$chunk = new Chunk(DOMDocumentFactory::fromString(
6060
'<ssp:Chunk xmlns:ssp="urn:x-simplesamlphp:namespace">some</ssp:Chunk>',
@@ -98,7 +98,7 @@ public function testMarshallingElementOrdering(): void
9898
*/
9999
public function testMarshalling(): void
100100
{
101-
$xpath = new XPath(StringValue::fromString('/bookstore/book[price>35.00]/title'));
101+
$xpath = XPath::fromString('/bookstore/book[price>35.00]/title');
102102
$attr = new XMLAttribute(C::NAMESPACE, 'ssp', 'attr1', StringValue::fromString('value1'));
103103
$chunk = new Chunk(DOMDocumentFactory::fromString(
104104
'<ssp:Chunk xmlns:ssp="urn:x-simplesamlphp:namespace">some</ssp:Chunk>',

0 commit comments

Comments
 (0)