Issues (2551)

tests/Wsdl/WsdlModelTest.php (2 issues)

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
The method getTypes() does not exist on Xml\Instance\ModelElementInstanceInterface. It seems like you code against a sub-type of Xml\Instance\ModelElementInstanceInterface such as Jabe\Impl\Model\Wsdl\Impl\Instance\DefinitionsImpl or Jabe\Impl\Model\Wsdl\Impl\Instance\DefinitionsImpl. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

29
        /** @scrutinizer ignore-call */ 
30
        $types = $defs->getTypes();
Loading history...
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
The assignment to $services is dead and can be removed.
Loading history...
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