Skip to content

Commit 9fefc29

Browse files
committed
fix to test case and phpcs workflow
1 parent 64cfd40 commit 9fefc29

File tree

2 files changed

+31
-7
lines changed

2 files changed

+31
-7
lines changed

.github/workflows/phpcs.yml

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Moodle PHPCS
1+
name: Moodle PHPCS Check
22

33
on:
44
push:
@@ -21,14 +21,38 @@ jobs:
2121
with:
2222
php-version: '8.1'
2323

24+
- name: Install Composer globally
25+
run: sudo apt-get install -y composer
26+
2427
- name: Install PHP_CodeSniffer
2528
run: composer global require squizlabs/php_codesniffer
2629

27-
- name: Install Moodle coding standard
30+
- name: Install Moodle Coding Standard
2831
run: |
2932
git clone https://github.com/moodlehq/moodle-cs.git ~/moodle-cs
30-
~/.composer/vendor/bin/phpcs --config-set installed_paths ~/moodle-cs
31-
~/.composer/vendor/bin/phpcs -i
33+
34+
- name: Install PHPCS dependency standards
35+
run: |
36+
composer global require dealerdirect/phpcodesniffer-composer-installer
37+
composer global require phpcompatibility/php-compatibility
38+
composer global require sirbrillig/phpcs-normalized-arrays
39+
composer global require object-calisthenics/phpcs-calisthenics-rules
40+
41+
- name: Configure installed_paths for PHPCS
42+
run: |
43+
~/.composer/vendor/bin/phpcs --config-set installed_paths \
44+
~/moodle-cs,\
45+
~/.composer/vendor/phpcompatibility/php-compatibility,\
46+
~/.composer/vendor/sirbrillig/phpcs-normalized-arrays,\
47+
~/.composer/vendor/object-calisthenics/phpcs-calisthenics-rules
48+
49+
- name: Show available standards
50+
run: ~/.composer/vendor/bin/phpcs -i
3251

3352
- name: Run PHPCS
34-
run: ~/.composer/vendor/bin/phpcs --standard=moodle --extensions=php --ignore=vendor/ .
53+
run: |
54+
~/.composer/vendor/bin/phpcs \
55+
--standard=moodle \
56+
--extensions=php \
57+
--ignore=vendor/ \
58+
.

tests/xapi_test_case.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,8 @@ private function assert_expected_statements(array $statements) {
198198
if (array_key_exists($pluginname, $plugins) || $plugintype == 'core') {
199199
$expectedstatements = $this->get_expected_statements();
200200
$this->assertEquals(
201-
utils\objectToArray($expectedstatements),
202-
utils\objectToArray($statements)
201+
utils\object_to_array($expectedstatements),
202+
utils\object_to_array($statements)
203203
);
204204
} else {
205205
$this->markTestSkipped('Plugin ' . $pluginname . ' not installed, skipping');

0 commit comments

Comments
 (0)