コード例 #1
0
ファイル: HttpTest.php プロジェクト: nbcutech/o3drupal
 /**
  * @group ZF-7756
  */
 public function testCallingGetRawBodyMultipleTimesShouldReturnSameValue()
 {
     require_once 'Zend/AllTests/StreamWrapper/PhpInput.php';
     Zend_AllTests_StreamWrapper_PhpInput::mockInput('foobar');
     $request = new Zend_Controller_Request_Http();
     $first = $request->getRawBody();
     $this->assertSame($first, $request->getRawBody());
     stream_wrapper_restore('php');
 }
コード例 #2
0
 public function testHttpRequestGeneratesFaultIfReadFromPhpInputFails()
 {
     Zend_AllTests_StreamWrapper_PhpInput::methodWillReturn('stream_open', false);
     $request = new Zend_XmlRpc_Request_Http();
     $this->assertTrue($request->isFault());
     $this->assertSame(630, $request->getFault()->getCode());
 }
コード例 #3
0
 public function stream_read($count)
 {
     self::$_arguments[__FUNCTION__] = func_get_args();
     if (array_key_exists(__FUNCTION__, self::$_returnValues)) {
         return self::$_returnValues[__FUNCTION__];
     }
     // To match the behavior of php://input, we need to clear out the data
     // as it is read
     if ($count > strlen(self::$_data)) {
         $data = self::$_data;
         self::$_data = '';
     } else {
         $data = substr(self::$_data, 0, $count);
         self::$_data = substr(self::$_data, $count);
     }
     return $data;
 }