mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 21:49:15 +01:00
MDL-79581 core_communication: Linting fixes
This commit is contained in:
parent
166d137407
commit
5ee0a5f760
@ -102,7 +102,7 @@ class command_test extends \advanced_testcase {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function url_parsing_provider(): array {
|
||||
public static function url_parsing_provider(): array {
|
||||
return [
|
||||
[
|
||||
'example/:id/endpoint',
|
||||
@ -194,7 +194,7 @@ class command_test extends \advanced_testcase {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function parameter_and_option_provider(): array {
|
||||
public static function parameter_and_option_provider(): array {
|
||||
$command = [
|
||||
'method' => 'PUT',
|
||||
'endpoint' => 'example/:id/endpoint',
|
||||
@ -289,7 +289,7 @@ class command_test extends \advanced_testcase {
|
||||
* Data provider for query parameter tests.
|
||||
* @return array
|
||||
*/
|
||||
public function query_provider(): array {
|
||||
public static function query_provider(): array {
|
||||
return [
|
||||
'no query' => [
|
||||
'query' => [],
|
||||
@ -350,7 +350,7 @@ class command_test extends \advanced_testcase {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function sendasjson_provider(): array {
|
||||
public static function sendasjson_provider(): array {
|
||||
return [
|
||||
'As JSON' => [
|
||||
'sendasjon' => true,
|
||||
|
@ -47,7 +47,7 @@ class matrix_client_test extends \advanced_testcase {
|
||||
* Data provider for valid calls to ::instance.
|
||||
* @return array
|
||||
*/
|
||||
public function instance_provider(): array {
|
||||
public static function instance_provider(): array {
|
||||
$testcases = [
|
||||
'Standard versions' => [
|
||||
null,
|
||||
@ -56,7 +56,7 @@ class matrix_client_test extends \advanced_testcase {
|
||||
];
|
||||
|
||||
// Remove a couple of versions.
|
||||
$versions = $this->get_current_versions();
|
||||
$versions = self::get_current_versions();
|
||||
array_pop($versions);
|
||||
array_pop($versions);
|
||||
|
||||
@ -251,7 +251,7 @@ class matrix_client_test extends \advanced_testcase {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function implements_feature_provider(): array {
|
||||
public static function implements_feature_provider(): array {
|
||||
return [
|
||||
'Basic supported feature' => [
|
||||
'v1.7',
|
||||
@ -299,12 +299,12 @@ class matrix_client_test extends \advanced_testcase {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function require_features_provider(): array {
|
||||
public static function require_features_provider(): array {
|
||||
// We'll just add to the standard testcases.
|
||||
$testcases = array_map(static function (array $testcase): array {
|
||||
$testcase[1] = [$testcase[1]];
|
||||
return $testcase;
|
||||
}, $this->implements_feature_provider());
|
||||
}, self::implements_feature_provider());
|
||||
|
||||
$testcases['Require many supported features'] = [
|
||||
'v1.6',
|
||||
@ -361,7 +361,7 @@ class matrix_client_test extends \advanced_testcase {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function get_version_provider(): array {
|
||||
public static function get_version_provider(): array {
|
||||
return [
|
||||
['v1.1', '1.1'],
|
||||
['v1.7', '1.7'],
|
||||
@ -415,7 +415,7 @@ class matrix_client_test extends \advanced_testcase {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function meets_version_provider(): array {
|
||||
public static function meets_version_provider(): array {
|
||||
return [
|
||||
'Same version' => ['v1.1', '1.1', true],
|
||||
'Same version latest' => ['v1.7', '1.7', true],
|
||||
|
@ -102,8 +102,8 @@ trait matrix_client_test_trait {
|
||||
array $unstablefeatures = null,
|
||||
): Response {
|
||||
$data = (object) [
|
||||
"versions" => array_values($this->get_current_versions()),
|
||||
"unstable_features" => $this->get_current_unstable_features(),
|
||||
"versions" => array_values(self::get_current_versions()),
|
||||
"unstable_features" => self::get_current_unstable_features(),
|
||||
];
|
||||
|
||||
if ($versions) {
|
||||
@ -122,7 +122,7 @@ trait matrix_client_test_trait {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function get_current_versions(): array {
|
||||
protected static function get_current_versions(): array {
|
||||
return [
|
||||
v1p1::class => "v1.1",
|
||||
v1p2::class => "v1.2",
|
||||
@ -138,7 +138,7 @@ trait matrix_client_test_trait {
|
||||
* A helper to get the current unstable features returned by synapse.
|
||||
* @return array
|
||||
*/
|
||||
protected function get_current_unstable_features(): array {
|
||||
protected static function get_current_unstable_features(): array {
|
||||
return [
|
||||
"org.matrix.label_based_filtering" => true,
|
||||
"org.matrix.e2e_cross_signing" => true,
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
namespace communication_matrix;
|
||||
|
||||
use core_communication\processor;
|
||||
use moodle_exception;
|
||||
|
||||
/**
|
||||
@ -105,7 +104,7 @@ class matrix_user_manager_test extends \advanced_testcase {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function get_formatted_matrix_userid_provider(): array {
|
||||
public static function get_formatted_matrix_userid_provider(): array {
|
||||
return [
|
||||
'alphanumeric' => [
|
||||
'https://matrix.example.org',
|
||||
@ -135,12 +134,12 @@ class matrix_user_manager_test extends \advanced_testcase {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function set_matrix_userid_in_moodle_provider(): array {
|
||||
public static function set_matrix_userid_in_moodle_provider(): array {
|
||||
return array_combine(
|
||||
array_keys($this->get_formatted_matrix_userid_provider()),
|
||||
array_keys(self::get_formatted_matrix_userid_provider()),
|
||||
array_map(
|
||||
fn($value) => [$value[2]],
|
||||
$this->get_formatted_matrix_userid_provider(),
|
||||
self::get_formatted_matrix_userid_provider(),
|
||||
),
|
||||
);
|
||||
}
|
||||
@ -196,7 +195,7 @@ class matrix_user_manager_test extends \advanced_testcase {
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function get_formatted_matrix_home_server_provider(): array {
|
||||
public static function get_formatted_matrix_home_server_provider(): array {
|
||||
return [
|
||||
'www is removed' => [
|
||||
'https://www.example.org',
|
||||
|
@ -16,13 +16,13 @@
|
||||
|
||||
namespace core_communication;
|
||||
|
||||
use communication_matrix\matrix_test_helper_trait;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
require_once(__DIR__ . '/../provider/matrix/tests/matrix_test_helper_trait.php');
|
||||
require_once(__DIR__ . '/communication_test_helper_trait.php');
|
||||
|
||||
use \communication_matrix\matrix_test_helper_trait;
|
||||
|
||||
/**
|
||||
* Class api_test to test the communication public api and its associated methods.
|
||||
*
|
||||
@ -33,7 +33,6 @@ use \communication_matrix\matrix_test_helper_trait;
|
||||
* @covers \core_communication\api
|
||||
*/
|
||||
class api_test extends \advanced_testcase {
|
||||
|
||||
use matrix_test_helper_trait;
|
||||
use communication_test_helper_trait;
|
||||
|
||||
|
@ -16,13 +16,13 @@
|
||||
|
||||
namespace core_communication;
|
||||
|
||||
use communication_matrix\matrix_test_helper_trait;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
require_once(__DIR__ . '/../provider/matrix/tests/matrix_test_helper_trait.php');
|
||||
require_once(__DIR__ . '/communication_test_helper_trait.php');
|
||||
|
||||
use \communication_matrix\matrix_test_helper_trait;
|
||||
|
||||
/**
|
||||
* Class processor_test to test the communication internal api and its associated methods.
|
||||
*
|
||||
@ -33,7 +33,6 @@ use \communication_matrix\matrix_test_helper_trait;
|
||||
* @coversDefaultClass \core_communication\processor
|
||||
*/
|
||||
class processor_test extends \advanced_testcase {
|
||||
|
||||
use matrix_test_helper_trait;
|
||||
use communication_test_helper_trait;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user