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.
|
* Ensure that hook_xmlrpc_alter() can hide even builtin methods.
|
||||||
*/
|
*/
|
||||||
protected function testAlterListMethods() {
|
protected function testAlterListMethods() {
|
||||||
// Ensure xmlrpc_test_xmlrpc_alter() is disabled and retrieve regular list of methods.
|
// Ensure xmlrpc_test.alter() is disabled and retrieve regular list of methods.
|
||||||
variable_set('xmlrpc_test_xmlrpc_alter', FALSE);
|
state()->set('xmlrpc_test.alter', FALSE);
|
||||||
$url = url('xmlrpc.php', array('absolute' => TRUE));
|
$url = url('xmlrpc.php', array('absolute' => TRUE));
|
||||||
$methods1 = xmlrpc($url, array('system.listMethods' => array()));
|
$methods1 = xmlrpc($url, array('system.listMethods' => array()));
|
||||||
|
|
||||||
// Enable the alter hook and retrieve the list of methods again.
|
// 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()));
|
$methods2 = xmlrpc($url, array('system.listMethods' => array()));
|
||||||
|
|
||||||
$diff = array_diff($methods1, $methods2);
|
$diff = array_diff($methods1, $methods2);
|
||||||
|
|
|
@ -68,7 +68,8 @@ function xmlrpc_test_xmlrpc() {
|
||||||
* Hide (or not) the system.methodSignature() service depending on a variable.
|
* Hide (or not) the system.methodSignature() service depending on a variable.
|
||||||
*/
|
*/
|
||||||
function xmlrpc_test_xmlrpc_alter(&$services) {
|
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;
|
$remove = NULL;
|
||||||
foreach ($services as $key => $value) {
|
foreach ($services as $key => $value) {
|
||||||
if (!is_array($value)) {
|
if (!is_array($value)) {
|
||||||
|
|
Loading…
Reference in New Issue