Skip to content
Snippets Groups Projects
Commit 477c52fa authored by Angie Byron's avatar Angie Byron
Browse files

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

parent 04228d4d
Branches
Tags
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -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)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment