public 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']; $this->tokenReplacement[$toReplace] = $replaceWith; $expectedResponse['headers']['Lock-Token'] = $realResponse['headers']['Lock-Token']; } foreach ($this->tokenReplacement 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']); }
protected function assertRunCorrect(array $expectedResponse, array $actualResponse) { $this->assertEquals($expectedResponse, $actualResponse, 'Response sent by WebDAV server incorrect.'); $this->setup->assertCustomAssertions($this); }