This repository has been archived by the owner on Jan 31, 2020. It is now read-only.
/
OnlineTest.php
86 lines (74 loc) · 2.75 KB
/
OnlineTest.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Soap
* @subpackage UnitTests
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* @namespace
*/
namespace ZendTest\Soap\AutoDiscover;
require_once __DIR__ . '/../TestAsset/commontypes.php';
use Zend\Soap\Client;
/**
* @category Zend
* @package Zend_Soap
* @subpackage UnitTests
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @group Zend_Soap
*/
class OnlineTest extends \PHPUnit_Framework_TestCase
{
protected $baseuri;
public function setUp()
{
if(!defined('TESTS_ZEND_SOAP_AUTODISCOVER_ONLINE_SERVER_BASEURI') || constant('TESTS_ZEND_SOAP_AUTODISCOVER_ONLINE_SERVER_BASEURI') == false) {
$this->markTestSkipped('The constant TESTS_ZEND_SOAP_AUTODISCOVER_ONLINE_SERVER_BASEURI has to be defined to allow the Online test to work.');
}
$this->baseuri = TESTS_ZEND_SOAP_AUTODISCOVER_ONLINE_SERVER_BASEURI;
}
public function testNestedObjectArrayResponse()
{
$wsdl = $this->baseuri."/server1.php?wsdl";
$b = new \ZendTest_Soap_TestAsset_ComplexTypeB();
$b->bar = "test";
$b->foo = "test";
$client = new Client($wsdl);
$ret = $client->request($b);
$this->assertTrue( is_array($ret) );
$this->assertEquals(1, count($ret) );
$this->assertTrue( is_array($ret[0]->baz) );
$this->assertEquals(3, count($ret[0]->baz) );
$baz = $ret[0]->baz;
$this->assertEquals("bar", $baz[0]->bar);
$this->assertEquals("bar", $baz[0]->foo);
$this->assertEquals("foo", $baz[1]->bar);
$this->assertEquals("foo", $baz[1]->foo);
$this->assertEquals("test", $baz[2]->bar);
$this->assertEquals("test", $baz[2]->foo);
}
public function testObjectResponse()
{
$wsdl = $this->baseuri."/server2.php?wsdl";
$client = new Client($wsdl);
$ret = $client->request("test", "test");
$this->assertTrue( ($ret instanceof \stdClass) );
$this->assertEquals("test", $ret->foo);
$this->assertEquals("test", $ret->bar);
}
}