/** * Test Amf0 credentials sent to the server * */ public function testAmf0CredentialsInHeader() { $myRequest = file_get_contents(dirname(__FILE__) . '/Request/mock/credentialsheaderAmf0.bin'); // send the mock object request to be deserialized $this->_request->initialize($myRequest); // Make sure that no headers where recieved $this->assertEquals(1, sizeof($this->_request->getAmfHeaders())); $requestHeaders = $this->_request->getAmfHeaders(); $this->assertTrue($requestHeaders[0] instanceof MessageHeader); $this->assertEquals('Credentials', $requestHeaders[0]->name); $this->assertFalse($requestHeaders[0]->mustRead); $data = $requestHeaders[0]->data; // Check the resulting header $this->assertEquals('admin', $data->userid); $this->assertEquals('pw123', $data->password); }
public function testResponseHeadersShouldBeSerializedWhenWritingMessage() { $this->testResponseShouldAggregateMessageHeaders(); $this->_response->finalize(); $response = $this->_response->getResponse(); $request = new Request(); $request->initialize($response); $headers = $request->getAmfHeaders(); $this->assertEquals(2, count($headers)); }