-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAbstractIntegrationTest.php
More file actions
43 lines (31 loc) · 1.1 KB
/
AbstractIntegrationTest.php
File metadata and controls
43 lines (31 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
declare(strict_types=1);
namespace Soap\EngineIntegrationTests;
use Dom\Element;
use PHPUnit\Framework\TestCase;
use Soap\Xml\Locator\SoapBodyLocator;
use Soap\Xml\Xpath\EnvelopePreset;
use VeeWee\Xml\Dom\Collection\NodeList;
use VeeWee\Xml\Dom\Document;
abstract class AbstractIntegrationTest extends TestCase
{
abstract protected function configureForWsdl(string $wsdl);
protected function locateFixture(string $fixture): string
{
$path = __DIR__.'/../fixtures' . $fixture;
static::assertFileExists($path);
return $path;
}
protected function runXpathOnBody(Document $xml, string $xpath): NodeList
{
$body = $xml->locate(new SoapBodyLocator());
$results = $xml->xpath(new EnvelopePreset($xml))->query($xpath, $body);
static::assertGreaterThan(0, $results->count());
return $results;
}
protected function runSingleElementXpathOnBody(Document $xml, string $xpath): Element
{
$body = $xml->locate(new SoapBodyLocator());
return $xml->xpath(new EnvelopePreset($xml))->querySingle($xpath, $body);
}
}