Ejemplo n.º 1
0
 public static function reset()
 {
     self::$requestBody = null;
     self::$responseStatus = null;
     self::$responseHeaders = null;
     self::$responseBody = null;
 }
Ejemplo n.º 2
0
 /**
  * testAuthentication 
  * 
  * @param mixed $input 
  * @param mixed $output 
  * @return void
  *
  * @dataProvider provideTestData
  */
 public function testAuthentication($input, $output)
 {
     static $num = 0;
     $num++;
     ezcWebdavTestTransportInjector::$requestBody = $input['body'];
     $_SERVER = array_merge($this->serverBase, $input['server']);
     $backend = $this->getBackend();
     ezcWebdavServer::getInstance()->handle($backend);
     if (isset(ezcWebdavTestTransportInjector::$responseHeaders['WWW-Authenticate'])) {
         // Replace nounce value with standard one, since this should not be predictable
         ezcWebdavTestTransportInjector::$responseHeaders['WWW-Authenticate']['digest'] = preg_replace('(nonce="[^"]+")', 'nonce="testnonce"', ezcWebdavTestTransportInjector::$responseHeaders['WWW-Authenticate']['digest']);
     }
     // Check for broken DateTime in PHP versions (timestamp time zone issue)
     if (version_compare(PHP_VERSION, '5.2.6', '<')) {
         if ($input['server']['REQUEST_METHOD'] === 'PROPFIND') {
             // PROPFIND responses contain dates in XML
             $this->markTestSkipped('PHP DateTime broken in versions < 5.2.6');
             return;
         }
         if (isset($output['headers']['ETag'])) {
             unset($output['headers']['ETag']);
             unset(ezcWebdavTestTransportInjector::$responseHeaders['ETag']);
         }
     }
     $this->assertEquals($output['status'], ezcWebdavTestTransportInjector::$responseStatus);
     $this->assertEquals($output['headers'], ezcWebdavTestTransportInjector::$responseHeaders);
     $this->assertEquals($output['body'], ezcWebdavTestTransportInjector::$responseBody);
 }
Ejemplo n.º 3
0
 protected function performTestSetRun(array $request)
 {
     ezcWebdavTestTransportInjector::reset();
     ezcWebdavTestTransportInjector::$requestBody = $request['body'];
     $_SERVER = $request['server'];
     // ini_set( 'xdebug.collect_return', 1 );
     // xdebug_start_trace( './traces/' . basename( $testSetName ) );
     $this->server->handle($this->backend);
     // xdebug_stop_trace();
     $response['status'] = ezcWebdavTestTransportInjector::$responseStatus;
     $response['headers'] = ezcWebdavTestTransportInjector::$responseHeaders;
     $response['body'] = ezcWebdavTestTransportInjector::$responseBody;
     return $response;
 }