reverted: --- b/xmlrpc.module +++ a/xmlrpc.module @@ -5,8 +5,6 @@ * Enables XML-RPC functionality. */ -// phpcs:disable Drupal.NamingConventions.ValidFunctionName.InvalidPrefix - use Drupal\Core\Url; /** @@ -31,9 +29,9 @@ * * Usage example: * @code + * $result = xmlrpc('http://example.com/xmlrpc', array( + * 'service.methodName' => array($parameter, $second, $third), + * )); - * $result = xmlrpc('http://example.com/xmlrpc', [ - * 'service.methodName' => [$parameter, $second, $third], - * ]); * @endcode * * @param string $url @@ -57,7 +55,6 @@ * @ingroup third_party */ function xmlrpc($url, array $args, array $headers = []) { -// phpcs:ignore Drupal.NamingConventions.ValidFunctionName.InvalidPrefix module_load_include('inc', 'xmlrpc'); return _xmlrpc($url, $args, $headers); } diff -u b/xmlrpc_example/tests/src/Functional/XmlRpcExampleTest.php b/xmlrpc_example/tests/src/Functional/XmlRpcExampleTest.php --- b/xmlrpc_example/tests/src/Functional/XmlRpcExampleTest.php +++ b/xmlrpc_example/tests/src/Functional/XmlRpcExampleTest.php @@ -74,18 +74,18 @@ // Add the integers. $edit = ['num1' => 3, 'num2' => 5]; $this->drupalGet('/xmlrpc_example/client'); - $this->submitForm($edit, 'Add the integers'); - $this->assertSession()->pageTextContains('The XML-RPC server returned this response: 8'); + $this->submitForm($edit, $this->t('Add the integers')); + $this->assertSession()->pageTextContains($this->t('The XML-RPC server returned this response: @num', ['@num' => 8])); // Subtract the integers. $edit = ['num1' => 8, 'num2' => 3]; $this->drupalGet('/xmlrpc_example/client'); - $this->submitForm($edit, 'Subtract the integers'); - $this->assertSession()->pageTextContains('The XML-RPC server returned this response: 5'); + $this->submitForm($edit, $this->t('Subtract the integers')); + $this->assertSession()->pageTextContains($this->t('The XML-RPC server returned this response: @num', ['@num' => 5])); // Request available methods. $this->drupalGet('/xmlrpc_example/client'); - $this->submitForm($edit, 'Request methods'); + $this->submitForm($edit, $this->t('Request methods')); // Assert that the XML-RPC Add method was found. $this->assertSession()->pageTextContains('xmlrpc_example.add'); // Assert that the XML-RPC Subtract method was found. @@ -97,7 +97,7 @@ // Verify multicall request. $edit = ['num1' => 5, 'num2' => 2]; $this->drupalGet('/xmlrpc_example/client'); - $this->submitForm($edit, 'Add and Subtract'); + $this->submitForm($edit, $this->t('Add and Subtract')); // Assert that the XML-RPC server returned the addition result. $this->assertSession()->pageTextContains('[0] => 7'); @@ -113,15 +113,15 @@ // Set different minimum and maximum values. $options = ['min' => 3, 'max' => 7]; $this->drupalGet('/xmlrpc_example/server'); - $this->submitForm($options, 'Save configuration'); + $this->submitForm($options, $this->t('Save configuration')); // Results limited to >= 3 and <= 7. - $this->assertSession()->pageTextContains('The configuration options have been saved'); + $this->assertSession()->pageTextContains($this->t('The configuration options have been saved')); $edit = ['num1' => 8, 'num2' => 3]; $this->drupalGet('/xmlrpc_example/client'); - $this->submitForm($edit, 'Subtract the integers'); - $this->assertSession()->pageTextContains('The XML-RPC server returned this response: 5'); + $this->submitForm($edit, $this->t('Subtract the integers')); + $this->assertSession()->pageTextContains($this->t('The XML-RPC server returned this response: @num', ['@num' => 5])); $result = xmlrpc($this->xmlRpcUrl, ['xmlrpc_example.add' => [3, 4]]); $this->assertEquals($result, 7, 'Successfully added 3+4 = 7'); @@ -145,16 +145,16 @@ // Enable XML-RPC service altering functionality. $options = ['alter_enabled' => TRUE]; $this->drupalGet('/xmlrpc_example/alter'); - $this->submitForm($options, 'Save configuration'); + $this->submitForm($options, $this->t('Save configuration')); // Assert that the results are not limited due to methods alteration. - $this->assertSession()->pageTextContains('The configuration options have been saved'); + $this->assertSession()->pageTextContains($this->t('The configuration options have been saved')); // After altering the functionality, the add and subtract methods have no // limits and should not return any error. $edit = ['num1' => 80, 'num2' => 3]; $this->drupalGet('/xmlrpc_example/client'); - $this->submitForm($edit, 'Subtract the integers'); - $this->assertSession()->pageTextContains('The XML-RPC server returned this response: 77'); + $this->submitForm($edit, $this->t('Subtract the integers')); + $this->assertSession()->pageTextContains($this->t('The XML-RPC server returned this response: @num', ['@num' => 77])); $result = xmlrpc($this->xmlRpcUrl, ['xmlrpc_example.add' => [30, 4]]); $this->assertEquals($result, 34, 'Successfully added 30+4 = 34');