Skip to content

Commit 9ab1113

Browse files
committed
Raise coverage
1 parent 99e775d commit 9ab1113

4 files changed

Lines changed: 62 additions & 38 deletions

File tree

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace SimpleSAML\WebServices\SecurityPolicy\XML\sp_200507\Type;
6+
7+
use DOMNodeList;
8+
use DOMXpath;
9+
use SimpleSAML\Assert\Assert;
10+
use SimpleSAML\XML\DOMDocumentFactory;
11+
use SimpleSAML\XMLSchema\Type\StringValue;
12+
13+
/**
14+
* @package simplesaml/xml-ws-security-policy
15+
*/
16+
class XPathValue extends StringValue
17+
{
18+
/**
19+
* Validate the content of the element.
20+
*
21+
* @throws \SimpleSAML\Assert\AssertionFailedException on failure
22+
*/
23+
protected function validateValue(string $content): void
24+
{
25+
$dom = new DOMXPath(DOMDocumentFactory::create());
26+
$result = $dom->evaluate($content);
27+
Assert::isInstanceOf($result, DOMNodeList::class);
28+
}
29+
}

src/XML/sp_200507/XPath.php

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,8 @@
44

55
namespace SimpleSAML\WebServices\SecurityPolicy\XML\sp_200507;
66

7-
use DOMNodeList;
8-
use DOMXPath;
9-
use SimpleSAML\WebServices\SecurityPolicy\Assert\Assert;
10-
use SimpleSAML\XML\DOMDocumentFactory;
7+
use SimpleSAML\WebServices\SecurityPolicy\XML\sp_200507\Type\XPathValue;
118
use SimpleSAML\XML\TypedTextContentTrait;
12-
use SimpleSAML\XMLSchema\Type\StringValue;
139

1410
/**
1511
* An XPath element
@@ -21,18 +17,5 @@ final class XPath extends AbstractSpElement
2117
use TypedTextContentTrait;
2218

2319

24-
public const string TEXTCONTENT_TYPE = StringValue::class;
25-
26-
27-
/**
28-
* Validate the content of the element.
29-
*
30-
* @throws \SimpleSAML\XMLSchema\Exception\SchemaViolationException on failure
31-
*/
32-
protected function validateContent(string $content): void
33-
{
34-
$dom = new DOMXPath(DOMDocumentFactory::create());
35-
$result = $dom->evaluate($content);
36-
Assert::isInstanceOf($result, DOMNodeList::class);
37-
}
20+
public const string TEXTCONTENT_TYPE = XPathValue::class;
3821
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace SimpleSAML\WebServices\SecurityPolicy\XML\sp_200702\Type;
6+
7+
use DOMNodeList;
8+
use DOMXpath;
9+
use SimpleSAML\Assert\Assert;
10+
use SimpleSAML\XML\DOMDocumentFactory;
11+
use SimpleSAML\XMLSchema\Type\StringValue;
12+
13+
/**
14+
* @package simplesaml/xml-ws-security-policy
15+
*/
16+
class XPathValue extends StringValue
17+
{
18+
/**
19+
* Validate the content of the element.
20+
*
21+
* @throws \SimpleSAML\Assert\AssertionFailedException on failure
22+
*/
23+
protected function validateValue(string $content): void
24+
{
25+
$dom = new DOMXPath(DOMDocumentFactory::create());
26+
$result = $dom->evaluate($content);
27+
Assert::isInstanceOf($result, DOMNodeList::class);
28+
}
29+
}

src/XML/sp_200702/XPath.php

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,8 @@
44

55
namespace SimpleSAML\WebServices\SecurityPolicy\XML\sp_200702;
66

7-
use DOMNodeList;
8-
use DOMXPath;
9-
use SimpleSAML\WebServices\SecurityPolicy\Assert\Assert;
10-
use SimpleSAML\XML\DOMDocumentFactory;
7+
use SimpleSAML\WebServices\SecurityPolicy\XML\sp_200702\Type\XPathValue;
118
use SimpleSAML\XML\TypedTextContentTrait;
12-
use SimpleSAML\XMLSchema\Type\StringValue;
139

1410
/**
1511
* An XPath element
@@ -21,18 +17,5 @@ final class XPath extends AbstractSpElement
2117
use TypedTextContentTrait;
2218

2319

24-
public const string TEXTCONTENT_TYPE = StringValue::class;
25-
26-
27-
/**
28-
* Validate the content of the element.
29-
*
30-
* @throws \SimpleSAML\XMLSchema\Exception\SchemaViolationException on failure
31-
*/
32-
protected function validateContent(string $content): void
33-
{
34-
$dom = new DOMXPath(DOMDocumentFactory::create());
35-
$result = $dom->evaluate($content);
36-
Assert::isInstanceOf($result, DOMNodeList::class);
37-
}
20+
public const string TEXTCONTENT_TYPE = XPathValue::class;
3821
}

0 commit comments

Comments
 (0)