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