Browse Source

Testing that a disabled system lookups really disable system lookups

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@17955 44c647ce-9c0f-0410-b52a-842ac1e357ba
lars 16 years ago
parent
commit
197af910cc
1 changed files with 20 additions and 1 deletions
  1. 20 1
      tests/Zend/XmlRpc/ClientTest.php

+ 20 - 1
tests/Zend/XmlRpc/ClientTest.php

@@ -288,7 +288,14 @@ class Zend_XmlRpc_ClientTest extends PHPUnit_Framework_TestCase
 
     public function testSkipsSystemCallWhenDirected()
     {
-        $this->markTestIncomplete('Cannot complete this test until we add logging of requests sent to HTTP test client');
+        $this->mockHttpClient();
+        $this->mockedHttpClient->expects($this->once())
+                               ->method('request')
+                               ->with('POST')
+                               ->will($this->returnValue($this->makeHttpResponseFor('foo')));
+        $this->xmlrpcClient->setHttpClient($this->mockedHttpClient);
+        $this->xmlrpcClient->setSkipSystemLookup(true);
+        $this->assertSame('foo', $this->xmlrpcClient->call('test.method'));
     }
 
     /**#@-*/
@@ -682,6 +689,12 @@ class Zend_XmlRpc_ClientTest extends PHPUnit_Framework_TestCase
         return implode("\r\n", $headers) . "\r\n\r\n$data\r\n\r\n";
     }
 
+    public function makeHttpResponseFor($nativeVars)
+    {
+        $response = $this->getServerResponseFor($nativeVars);
+        return Zend_Http_Response::fromString($response);
+    }
+
     public function mockIntrospector()
     {
         $this->mockedIntrospector = $this->getMock(
@@ -694,6 +707,12 @@ class Zend_XmlRpc_ClientTest extends PHPUnit_Framework_TestCase
         );
         $this->xmlrpcClient->setIntrospector($this->mockedIntrospector);
     }
+
+    public function mockHttpClient()
+    {
+        $this->mockedHttpClient = $this->getMock('Zend_Http_Client');
+        $this->xmlrpcClient->setHttpClient($this->mockedHttpClient);
+    }
 }
 
 // Call Zend_XmlRpc_ClientTest::main() if this source file is executed directly.