Integration test fixed
This commit is contained in:
parent
e6beef5a80
commit
45cce3a41c
|
@ -3,8 +3,6 @@
|
|||
namespace BeSimple\SoapClient;
|
||||
|
||||
use BeSimple\SoapBundle\Soap\SoapAttachment;
|
||||
use BeSimple\SoapClient\Curl\CurlOptions;
|
||||
use BeSimple\SoapClient\SoapOptions\SoapClientOptions;
|
||||
use BeSimple\SoapCommon\ClassMap;
|
||||
use BeSimple\SoapCommon\SoapOptions\SoapOptions;
|
||||
use BeSimple\SoapCommon\SoapOptionsBuilder;
|
||||
|
@ -18,11 +16,11 @@ class SoapClientTest extends PHPUnit_Framework_TestCase
|
|||
{
|
||||
const CACHE_DIR = __DIR__ . '/../../../cache';
|
||||
const FIXTURES_DIR = __DIR__ . '/../../Fixtures';
|
||||
const TEST_HTTP_URL = 'http://localhost:9000/tests';
|
||||
const TEST_ENDPOINT_UK = 'http://www.webservicex.net/uklocation.asmx';
|
||||
const TEST_REMOTE_WSDL_UK = 'http://www.webservicex.net/uklocation.asmx?WSDL';
|
||||
const TEST_REMOTE_ENDPOINT_NOT_WORKING = 'http://www.nosuchserverexist.tld/doesnotexist.endpoint';
|
||||
const TEST_REMOTE_WSDL_NOT_WORKING = 'http://www.nosuchserverexist.tld/doesnotexist.endpoint?wsdl';
|
||||
const TEST_REMOTE_WSDL_SWA = 'https://demo2815480.mockable.io/soap/testGenerator?WSDL';
|
||||
|
||||
public function testSoapCall()
|
||||
{
|
||||
|
@ -231,14 +229,16 @@ class SoapClientTest extends PHPUnit_Framework_TestCase
|
|||
}
|
||||
|
||||
/**
|
||||
* @see This test needs a working SWA endpoint. Examine Tests/Mock directory for details
|
||||
* @see This test needs to start a mock server first
|
||||
*/
|
||||
public function testSoapCallSwaWithAttachmentsOnResponse()
|
||||
{
|
||||
$localWebServerProcess = popen('php -S localhost:9000 > /dev/null 2>&1 &', 'r');
|
||||
|
||||
$soapClient = $this->getSoapBuilder()->buildWithSoapHeader(
|
||||
SoapClientOptionsBuilder::createWithTracing(),
|
||||
SoapOptionsBuilder::createSwaWithClassMapV11(
|
||||
self::TEST_REMOTE_WSDL_SWA,
|
||||
self::TEST_HTTP_URL.'/SwaEndpoint.php?wsdl',
|
||||
new ClassMap([
|
||||
'GenerateTestRequest' => GenerateTestRequest::class,
|
||||
]),
|
||||
|
@ -265,6 +265,8 @@ class SoapClientTest extends PHPUnit_Framework_TestCase
|
|||
|
||||
file_put_contents(self::CACHE_DIR . '/testSoapCallSwaWithAttachmentsOnResponse.xml', $soapResponse->getContent());
|
||||
file_put_contents(self::CACHE_DIR . '/testSoapCallSwaWithAttachmentsOnResponse.txt', $firstAttachment->getContent());
|
||||
|
||||
pclose($localWebServerProcess);
|
||||
}
|
||||
|
||||
public function removeOneTimeData($string)
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
|
||||
--Part_13_58e3bc35f3743.58e3bc35f376f
|
||||
Content-Type: application/soap+xml; charset=utf-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
Content-ID: <part-424dbe68-e2da-450f-9a82-cc3e82742503@response.info>
|
||||
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://schema.testcase"><env:Body xmlns:rpc="http://www.w3.org/2003/05/soap-rpc"><ns1:generateTestResponse><rpc:result>generateTestReturn</rpc:result><generateTestReturn><fileName>dummy-attachment.txt</fileName></generateTestReturn></ns1:generateTestResponse></env:Body></env:Envelope>
|
||||
|
||||
--Part_13_58e3bc35f3743.58e3bc35f376f
|
||||
Content-Type: text/plain; charset=utf-8
|
||||
Content-Transfer-Encoding: binary
|
||||
Content-ID: <dummy-attachment.txt>
|
||||
Content-Location: dummy-attachment.txt
|
||||
|
||||
Hello world!
|
||||
--Part_13_58e3bc35f3743.58e3bc35f376f--
|
|
@ -0,0 +1,61 @@
|
|||
<?xml version="1.0"?>
|
||||
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://schema.testcase" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://schema.testcase">
|
||||
<wsdl:types>
|
||||
<xsd:schema targetNamespace="http://schema.testcase">
|
||||
<xsd:complexType name="SoapHeaderEntity">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="user" type="xsd:string" minOccurs="1">
|
||||
<xsd:annotation>
|
||||
<xsd:documentation>User name for authorization</xsd:documentation>
|
||||
</xsd:annotation>
|
||||
</xsd:element>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
<xsd:element name="SoapHeader" type="tns:SoapHeaderEntity"/>
|
||||
<xsd:complexType name="GenerateTestRequest">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="salutation" type="xsd:string" minOccurs="0"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
<xsd:complexType name="GenerateTestResponse">
|
||||
<xsd:sequence>
|
||||
<xsd:element name="fileName" type="xsd:string" minOccurs="1"/>
|
||||
</xsd:sequence>
|
||||
</xsd:complexType>
|
||||
</xsd:schema>
|
||||
</wsdl:types>
|
||||
<message name="SoapHeader">
|
||||
<part name="SoapHeader" element="tns:SoapHeader"/>
|
||||
</message>
|
||||
<message name="GenerateTestRequest">
|
||||
<part name="request" type="tns:GenerateTestRequest"/>
|
||||
</message>
|
||||
<message name="GenerateTestResponse">
|
||||
<part name="generateTestReturn" type="tns:GenerateTestResponse"/>
|
||||
</message>
|
||||
<wsdl:portType name="TestGeneratorServiceSoapPortType">
|
||||
<wsdl:operation name="generateTest">
|
||||
<wsdl:input message="tns:GenerateTestRequest"/>
|
||||
<wsdl:output message="tns:GenerateTestResponse"/>
|
||||
</wsdl:operation>
|
||||
</wsdl:portType>
|
||||
<binding name="TestGeneratorServiceSoapBinding" type="tns:TestGeneratorServiceSoapPortType">
|
||||
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
|
||||
<wsdl:operation name="generateTest">
|
||||
<soap:operation soapAction="TestGeneratorService.generateTest" style="rpc"/>
|
||||
<wsdl:input>
|
||||
<soap:header use="literal" message="tns:SoapHeader" part="SoapHeader" namespace="http://schema.testcase"/>
|
||||
<soap:body use="literal" part="request" namespace="http://schema.testcase"/>
|
||||
</wsdl:input>
|
||||
<wsdl:output>
|
||||
<soap:body use="literal" namespace="http://schema.testcase"/>
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
</binding>
|
||||
<wsdl:service name="TestGeneratorService">
|
||||
<xsd:documentation>WSDL file for TestGeneratorService</xsd:documentation>
|
||||
<port name="TestGeneratorServiceSoapPortType" binding="tns:TestGeneratorServiceSoapBinding">
|
||||
<soap:address location="http://localhost:8000/tests/SwaEndpoint.php"/>
|
||||
</port>
|
||||
</wsdl:service>
|
||||
</wsdl:definitions>
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
const FIXTURES_DIR = __DIR__.'/Fixtures';
|
||||
const CACHE_DIR = __DIR__.'/../cache';
|
||||
|
||||
if (isset($_GET['wsdl'])) {
|
||||
header('Content-type: text/xml');
|
||||
echo file_get_contents(FIXTURES_DIR.'/Message/Response/soapCallWithSwaAttachmentsOnResponse.wsdl');
|
||||
exit;
|
||||
}
|
||||
|
||||
header('Content-type: text/xml');
|
||||
echo file_get_contents(FIXTURES_DIR.'/Message/Response/soapCallWithSwaAttachmentsOnResponse.response.message');
|
Loading…
Reference in New Issue