forked from phpro/soap-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSimpleContentTest.php
54 lines (44 loc) · 1.5 KB
/
SimpleContentTest.php
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
44
45
46
47
48
49
50
51
52
53
54
<?php
declare( strict_types=1 );
namespace PhproTest\SoapClient\Functional\Encoding;
use PhproTest\SoapClient\Functional\AbstractSoapTestCase;
use SoapServer;
class SimpleContentTest extends AbstractSoapTestCase
{
protected function configureServer(SoapServer $server)
{
$server->setObject(new class() {
public function validate($input)
{
return $input;
}
});
}
protected function getWsdl(): string
{
return FIXTURE_DIR . '/wsdl/functional/simpleContent.wsdl';
}
protected function getSoapOptions(): array {
return $this->provideBasicWsdlOptions();
}
/** @test */
function it_can_parse_simple_content_types()
{
$types = $this->client->getSoapTypes();
$type = $types['SimpleContent'];
$this->assertEquals($type['country'], 'string');
$this->assertEquals($type['_'], 'integer');
}
/**
* @test
* @runInSeparateProcess
*/
function it_uses_underscores_internally_as_node_value_of_simple_content()
{
$input = $output = ['_' => 132, 'country' => 'BE'];
$response = (array) $this->client->validate($input);
$this->assertEquals($output, $response);
$this->assertContains('<input xsi:type="ns2:SimpleContent" country="BE">132</input>', $this->client->__getLastRequest());
$this->assertContains('<output xsi:type="ns2:SimpleContent" country="BE">132</output>', $this->client->__getLastResponse());
}
}