mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Added tests to use Xml with SOAP.
This commit is contained in:
parent
a1eeb03e36
commit
9239caa589
3 changed files with 56 additions and 0 deletions
|
@ -489,6 +489,38 @@ class XmlTest extends CakeTestCase {
|
|||
$this->assertEqual(str_replace(array("\r", "\n"), '', $xml->asXML()), $xmlText);
|
||||
}
|
||||
|
||||
/**
|
||||
* testSoap
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testSoap() {
|
||||
$xmlRequest = Xml::build(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'fixtures' . DS . 'soap_request.xml');
|
||||
$expected = array(
|
||||
'Envelope' => array(
|
||||
'@encodingStyle' => 'http://www.w3.org/2001/12/soap-encoding',
|
||||
'Body' => array(
|
||||
'GetStockPrice' => array(
|
||||
'StockName' => 'IBM'
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
$this->assertEqual(Xml::toArray($xmlRequest), $expected);
|
||||
|
||||
$xmlResponse = Xml::build(TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'fixtures' . DS . 'soap_response.xml');
|
||||
$expected = array(
|
||||
'Envelope' => array(
|
||||
'@encodingStyle' => 'http://www.w3.org/2001/12/soap-encoding',
|
||||
'Body' => array(
|
||||
'GetStockPriceResponse' => array(
|
||||
'Price' => '34.5'
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* data provider for toArray() failures
|
||||
*
|
||||
|
|
12
cake/tests/fixtures/soap_request.xml
vendored
Normal file
12
cake/tests/fixtures/soap_request.xml
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0"?>
|
||||
<soap:Envelope
|
||||
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
|
||||
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
|
||||
|
||||
<soap:Body xmlns:m="http://www.example.org/stock">
|
||||
<m:GetStockPrice>
|
||||
<m:StockName>IBM</m:StockName>
|
||||
</m:GetStockPrice>
|
||||
</soap:Body>
|
||||
|
||||
</soap:Envelope>
|
12
cake/tests/fixtures/soap_response.xml
vendored
Normal file
12
cake/tests/fixtures/soap_response.xml
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0"?>
|
||||
<soap:Envelope
|
||||
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
|
||||
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
|
||||
|
||||
<soap:Body xmlns:m="http://www.example.org/stock">
|
||||
<m:GetStockPriceResponse>
|
||||
<m:Price>34.5</m:Price>
|
||||
</m:GetStockPriceResponse>
|
||||
</soap:Body>
|
||||
|
||||
</soap:Envelope>
|
Loading…
Reference in a new issue