* @license MIT * * @group Coverage */ class BaseAdapterTest extends PHPUnit_Framework_TestCase { /** * {@inheritDoc} * * @covers \ProxyManager\Factory\RemoteObject\Adapter\BaseAdapter::__construct * @covers \ProxyManager\Factory\RemoteObject\Adapter\BaseAdapter::call * @covers \ProxyManager\Factory\RemoteObject\Adapter\Soap::getServiceName */ public function testBaseAdapter() { $client = $this ->getMockBuilder('Zend\Server\Client') ->setMethods(array('call')) ->getMock(); $adapter = $this->getMockForAbstractClass( 'ProxyManager\\Factory\\RemoteObject\\Adapter\\BaseAdapter', array($client) ); $client ->expects($this->once()) ->method('call') ->with('foobarbaz', array('tab' => 'taz')) ->will($this->returnValue('baz')); $adapter ->expects($this->once()) ->method('getServiceName') ->with('foo', 'bar') ->will($this->returnValue('foobarbaz')); $this->assertSame('baz', $adapter->call('foo', 'bar', array('tab' => 'taz'))); } /** * {@inheritDoc} * * @covers \ProxyManager\Factory\RemoteObject\Adapter\BaseAdapter::__construct * @covers \ProxyManager\Factory\RemoteObject\Adapter\BaseAdapter::call * @covers \ProxyManager\Factory\RemoteObject\Adapter\Soap::getServiceName */ public function testBaseAdapterWithServiceMap() { $client = $this ->getMockBuilder('Zend\Server\Client') ->setMethods(array('call')) ->getMock(); $adapter = $this->getMockForAbstractClass( 'ProxyManager\\Factory\\RemoteObject\\Adapter\\BaseAdapter', array($client, array('foobarbaz' => 'mapped')) ); $client ->expects($this->once()) ->method('call') ->with('mapped', array('tab' => 'taz')) ->will($this->returnValue('baz')); $adapter ->expects($this->once()) ->method('getServiceName') ->with('foo', 'bar') ->will($this->returnValue('foobarbaz')); $this->assertSame('baz', $adapter->call('foo', 'bar', array('tab' => 'taz'))); } }