Commit 477c52fa authored by webchick's avatar webchick

Issue #1848066 by ACF, Gaelan: Change variable xmlrpc_test_xmlrpc_alter() to the state system.

parent 04228d4d
......@@ -47,13 +47,13 @@ function testSizedMessages() {
* Ensure that hook_xmlrpc_alter() can hide even builtin methods.
*/
protected function testAlterListMethods() {
// Ensure xmlrpc_test_xmlrpc_alter() is disabled and retrieve regular list of methods.
variable_set('xmlrpc_test_xmlrpc_alter', FALSE);
// Ensure xmlrpc_test.alter() is disabled and retrieve regular list of methods.
state()->set('xmlrpc_test.alter', FALSE);
$url = url('xmlrpc.php', array('absolute' => TRUE));
$methods1 = xmlrpc($url, array('system.listMethods' => array()));
// Enable the alter hook and retrieve the list of methods again.
variable_set('xmlrpc_test_xmlrpc_alter', TRUE);
state()->set('xmlrpc_test.alter', TRUE);
$methods2 = xmlrpc($url, array('system.listMethods' => array()));
$diff = array_diff($methods1, $methods2);
......
......@@ -68,7 +68,8 @@ function xmlrpc_test_xmlrpc() {
* Hide (or not) the system.methodSignature() service depending on a variable.
*/
function xmlrpc_test_xmlrpc_alter(&$services) {
if (variable_get('xmlrpc_test_xmlrpc_alter', FALSE)) {
$xmlprc_alter = state()->get('xmlrpc_test.alter') ?: FALSE;
if ($xmlprc_alter) {
$remove = NULL;
foreach ($services as $key => $value) {
if (!is_array($value)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment