function XMLRPCBasicTestCase::testInvalidMessageParsing
Ensure that XML-RPC correctly handles invalid messages when parsing.
File
-
modules/
simpletest/ tests/ xmlrpc.test, line 57
Class
- XMLRPCBasicTestCase
- Perform basic XML-RPC tests that do not require addition callbacks.
Code
protected function testInvalidMessageParsing() {
$invalid_messages = array(
array(
'message' => xmlrpc_message(''),
'assertion' => 'Empty message correctly rejected during parsing.',
),
array(
'message' => xmlrpc_message('<?xml version="1.0" encoding="ISO-8859-1"?>'),
'assertion' => 'Empty message with XML declaration correctly rejected during parsing.',
),
array(
'message' => xmlrpc_message('<?xml version="1.0"?><params><param><value><string>value</string></value></param></params>'),
'assertion' => 'Non-empty message without a valid message type is rejected during parsing.',
),
array(
'message' => xmlrpc_message('<methodResponse><params><param><value><string>value</string></value></param></methodResponse>'),
'assertion' => 'Non-empty malformed message is rejected during parsing.',
),
);
foreach ($invalid_messages as $assertion) {
$this->assertFalse(xmlrpc_message_parse($assertion['message']), $assertion['assertion']);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.