Issue #1848066 by ACF, Gaelan: Change variable xmlrpc_test_xmlrpc_alter() to the state system.
parent
04228d4d79
commit
477c52fad8
|
@ -47,13 +47,13 @@ class XmlRpcMessagesTest extends WebTestBase {
|
|||
* 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)) {
|
||||
|
|
Loading…
Reference in New Issue