diff --git a/Tests/SoapKernelTest.php b/Tests/SoapKernelTest.php deleted file mode 100644 index bb6dc5c..0000000 --- a/Tests/SoapKernelTest.php +++ /dev/null @@ -1,77 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Bundle\WebServiceBundle\Tests; - -use Bundle\WebServiceBundle\Soap\SoapServerFactory; - -use Bundle\WebServiceBundle\Converter\ConverterRepository; - -use Symfony\Component\HttpFoundation\Request; - -use Bundle\WebServiceBundle\SoapKernel; -use Bundle\WebServiceBundle\Soap\SoapRequest; -use Bundle\WebServiceBundle\Soap\SoapResponse; - -use Bundle\WebServiceBundle\ServiceBinding\ServiceBinder; -use Bundle\WebServiceBundle\ServiceBinding\RpcLiteralResponseMessageBinder; -use Bundle\WebServiceBundle\ServiceBinding\RpcLiteralRequestMessageBinder; - -use Bundle\WebServiceBundle\ServiceDefinition\ServiceDefinition; -use Bundle\WebServiceBundle\ServiceDefinition\Method; -use Bundle\WebServiceBundle\ServiceDefinition\Loader\XmlFileLoader; - -/** - * UnitTest for \Bundle\WebServiceBundle\SoapKernel. - * - * @author Christian Kerl - */ -class SoapKernelTest extends \PHPUnit_Framework_TestCase -{ - private static $soapRequestContent = '1020'; - private static $soapResponseContent = '200'; - - private $soapKernel; - - public function setUp() - { - $serviceDefinition = new ServiceDefinition('api'); - $serviceDefinitionLoader = new XmlFileLoader(__DIR__ . '/fixtures/api-servicedefinition.xml'); - $serviceDefinitionLoader->loadServiceDefinition($serviceDefinition); - $serviceDefinitionDumper = new StaticFileDumper(__DIR__ . '/fixtures/api.wsdl'); - $requestMessageBinder = new RpcLiteralRequestMessageBinder(); - $responseMessageBinder = new RpcLiteralResponseMessageBinder(); - - $serviceBinder = new ServiceBinder($serviceDefinition, $requestMessageBinder, $responseMessageBinder); - $converterRepository = new ConverterRepository(); - $soapServerFactory = new SoapServerFactory($serviceDefinition, $converterRepository, $serviceDefinitionDumper); - $httpKernel = $this->getMock('Symfony\\Component\\HttpKernel\\HttpKernelInterface'); - $httpKernel->expects($this->any()) - ->method('handle') - ->will($this->returnValue(new SoapResponse(200))); - - $this->soapKernel = new SoapKernel($serviceBinder, $soapServerFactory, $httpKernel); - } - - public function testHandle() - { - $response = $this->soapKernel->handle(new SoapRequest(self::$soapRequestContent)); - - $this->assertEquals(200, $response->getReturnValue()); - $this->assertXmlStringEqualsXmlString(self::$soapResponseContent, $response->getContent()); - } - - public function testHandleWithInvalidRequest() - { - $this->setExpectedException('InvalidArgumentException'); - - $this->soapKernel->handle(new Request()); - } -} \ No newline at end of file diff --git a/Tests/SoapRequestTest.php b/Tests/SoapRequestTest.php index 4f041a7..8256815 100644 --- a/Tests/SoapRequestTest.php +++ b/Tests/SoapRequestTest.php @@ -23,7 +23,7 @@ class SoapRequestTest extends \PHPUnit_Framework_TestCase { $content = $this->loadRequestContentFixture('mtom/simple.txt'); - $request = new SoapRequest($content); + $request = new SoapRequest(array(), array(), array(), array(), array(), array(), $content); $request->server->set('CONTENT_TYPE', 'multipart/related; type="application/xop+xml";start="";boundary="uuid:0ca0e16e-feb1-426c-97d8-c4508ada5e82+id=7";start-info="application/soap+xml"'); $message = $request->getSoapMessage(); diff --git a/Tests/StaticFileDumper.php b/Tests/StaticFileDumper.php deleted file mode 100644 index 3d91744..0000000 --- a/Tests/StaticFileDumper.php +++ /dev/null @@ -1,24 +0,0 @@ - - * - * This source file is subject to the MIT license that is bundled - * with this source code in the file LICENSE. - */ - -namespace Bundle\WebServiceBundle\Tests; - -use Bundle\WebServiceBundle\ServiceDefinition\Dumper\FileDumper; - -use Bundle\WebServiceBundle\ServiceDefinition\ServiceDefinition; -use Bundle\WebServiceBundle\ServiceDefinition\Dumper\DumperInterface; - -class StaticFileDumper extends FileDumper -{ - public function dumpServiceDefinition(ServiceDefinition $definition) - { - return $this->file; - } -} \ No newline at end of file