1 | <?php |
||
2 | |||
3 | namespace Tests\WSDL; |
||
4 | |||
5 | use PHPUnit\Framework\TestCase; |
||
6 | use Jabe\Impl\Model\Wsdl\Impl\WsdlParser; |
||
7 | use Jabe\Impl\Model\Wsdl\Instance\{ |
||
8 | BindingInterface, |
||
9 | ServiceInterface |
||
10 | }; |
||
11 | |||
12 | class WsdlModelTest extends TestCase |
||
13 | { |
||
14 | protected $modelParser; |
||
15 | |||
16 | protected $modelInstance; |
||
17 | |||
18 | protected function parseModel(string $test) |
||
19 | { |
||
20 | $this->modelParser = new WsdlParser(); |
||
21 | $xml = fopen("tests/Wsdl/Resources/$test.wsdl", 'r+'); |
||
22 | $this->modelInstance = $this->modelParser->parseModelFromStream($xml); |
||
23 | } |
||
24 | |||
25 | public function testCounter(): void |
||
26 | { |
||
27 | $this->parseModel("counter"); |
||
28 | $defs = $this->modelInstance->getDocumentElement(); |
||
29 | $types = $defs->getTypes(); |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
30 | $this->assertFalse($types === null); |
||
31 | $schema = $defs->getTypes()->getSchema(); |
||
32 | $this->assertFalse($schema === null); |
||
33 | $services = $this->modelInstance->getModelElementsByType(ServiceInterface::class); |
||
0 ignored issues
–
show
|
|||
34 | $bindings = $this->modelInstance->getModelElementsByType(BindingInterface::class); |
||
35 | $this->assertCount(1, $bindings); |
||
36 | |||
37 | $this->assertEquals("tns:Counter", $bindings[0]->getType()); |
||
38 | |||
39 | $services = $this->modelInstance->getModelElementsByType(ServiceInterface::class); |
||
40 | $this->assertCount(1, $services); |
||
41 | |||
42 | $service = $services[0]; |
||
43 | $this->assertEquals("http://localhost:63081/webservicemock", $service->getPort()->getAddress()->getLocation()); |
||
44 | $this->assertEquals("http://localhost:63081/webservicemock", $service->getEndpoint()); |
||
45 | } |
||
46 | } |
||
47 |