* * 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 Symfony\Component\HttpFoundation\Request; use Bundle\WebServiceBundle\SoapKernel; use Bundle\WebServiceBundle\Soap\SoapRequest; use Bundle\WebServiceBundle\Soap\SoapResponse; /** * 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() { $soapServer = new \SoapServer(__DIR__ . '/fixtures/api.wsdl'); $httpKernel = $this->getMock('Symfony\\Component\\HttpKernel\\HttpKernelInterface'); $httpKernel->expects($this->any()) ->method('handle') ->will($this->returnValue(new SoapResponse(200))); $this->soapKernel = new SoapKernel($soapServer, $httpKernel); } public function testHandle() { $response = $this->soapKernel->handle(new SoapRequest(self::$soapRequestContent)); $this->assertEquals(200, $response->getReturnValue()); $this->assertEquals(self::$soapResponseContent, $response->getContent()); } /** * @expectedException InvalidArgumentException */ public function testHandleWithInvalidRequest() { $this->soapKernel->handle(new Request()); } }