Beispiel #1
0
 public function testHeadersReadFromFrameIfInFocus()
 {
     $frame = new MockSimplePage();
     $frame->returnsByValue('getUrl', new SimpleUrl('http://localhost/stuff'));
     $frame->returnsByValue('getRequest', 'POST stuff');
     $frame->returnsByValue('getMethod', 'POST');
     $frame->returnsByValue('getRequestData', array('a' => 'A'));
     $frame->returnsByValue('getHeaders', 'Header: content');
     $frame->returnsByValue('getMimeType', 'text/xml');
     $frame->returnsByValue('getResponseCode', 401);
     $frame->returnsByValue('getTransportError', 'Could not parse headers');
     $frame->returnsByValue('getAuthentication', 'Basic');
     $frame->returnsByValue('getRealm', 'Safe place');
     $frameset = new SimpleFrameset(new MockSimplePage());
     $frameset->addFrame($frame);
     $frameset->setFrameFocusByIndex(1);
     $url = new SimpleUrl('http://localhost/stuff');
     $url->setTarget(1);
     $this->assertIdentical($frameset->getUrl(), $url);
     $this->assertIdentical($frameset->getRequest(), 'POST stuff');
     $this->assertIdentical($frameset->getMethod(), 'POST');
     $this->assertIdentical($frameset->getRequestData(), array('a' => 'A'));
     $this->assertIdentical($frameset->getHeaders(), 'Header: content');
     $this->assertIdentical($frameset->getMimeType(), 'text/xml');
     $this->assertIdentical($frameset->getResponseCode(), 401);
     $this->assertIdentical($frameset->getTransportError(), 'Could not parse headers');
     $this->assertIdentical($frameset->getAuthentication(), 'Basic');
     $this->assertIdentical($frameset->getRealm(), 'Safe place');
 }