protected function runTestSet($testSetName)
 {
     parent::runTestSet($testSetName);
     $assertionFile = "{$testSetName}_assertions.php";
     if (file_exists($assertionFile)) {
         $assertionObject = (include $assertionFile);
         $assertionReflection = new ReflectionObject($assertionObject);
         foreach ($assertionReflection->getMethods() as $assertionMethod) {
             $assertionMethod->invoke($assertionObject, $this->backend);
         }
     }
 }
Exemplo n.º 2
0
 public function __construct()
 {
     parent::__construct();
     // Initialize directory to store backend dumps in
     if (self::STORE_BACKEND && self::$backendDir === null) {
         self::$backendDir = $this->createTempDir('WebdavBackendDump');
     }
     $this->setupTestEnvironment();
     // Reset the backend at start of the suite
     foreach (glob($this->dataDir . '/*request_server.php') as $testSetFile) {
         $this->testSets[] = substr($testSetFile, 0, -19);
     }
 }
Exemplo n.º 3
0
 protected function adjustResponse(array &$realResponse, array &$expectedResponse)
 {
     parent::adjustResponse($realResponse, $expectedResponse);
     if (isset($realResponse['headers']['Lock-Token']) && !isset($expectedResponse['headers']['Lock-Token'])) {
         throw new RuntimeException('Real response had Lock-Token, expected not!');
     }
     if (!isset($realResponse['headers']['Lock-Token']) && isset($expectedResponse['headers']['Lock-Token'])) {
         throw new RuntimeException('Expected response had Lock-Token, real not!');
     }
     if (isset($realResponse['headers']['Lock-Token'])) {
         $toReplace = $expectedResponse['headers']['Lock-Token'];
         $replaceWith = $realResponse['headers']['Lock-Token'];
         self::$tokenReplacements[$toReplace] = $replaceWith;
         $expectedResponse['headers']['Lock-Token'] = $realResponse['headers']['Lock-Token'];
     }
     foreach (self::$tokenReplacements as $from => $to) {
         $expectedResponse['body'] = preg_replace('(' . preg_quote($from) . ')', $to, $expectedResponse['body']);
     }
     // Unify last access dates
     $realResponse['body'] = preg_replace('([0-9]{4}-[0-9]{2}-[0-9]{2}[0-9T:+]+)', '2008-11-09T22:14:18+00:00', $realResponse['body']);
     $expectedResponse['body'] = preg_replace('([0-9]{4}-[0-9]{2}-[0-9]{2}[0-9T:+]+)', '2008-11-09T22:14:18+00:00', $expectedResponse['body']);
 }