Skip to content

Commit aa21c70

Browse files
authored
Merge pull request #159 from timhunt/fixes
Unit test fixes
2 parents a9c338f + 043d175 commit aa21c70

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,19 @@ jobs:
99
fail-fast: false
1010
matrix:
1111
include:
12+
- php: '8.0'
13+
moodle-branch: 'master'
14+
database: 'pgsql'
1215
- php: '7.4'
13-
moodle-branch: 'MOODLE_400_STABLE'
16+
moodle-branch: 'MOODLE_401_STABLE'
1417
database: 'pgsql'
1518
- php: '7.3'
1619
moodle-branch: 'MOODLE_400_STABLE'
1720
database: 'mariadb'
1821

1922
services:
2023
postgres:
21-
image: postgres:10
24+
image: postgres:13
2225
env:
2326
POSTGRES_USER: 'postgres'
2427
POSTGRES_HOST_AUTH_METHOD: 'trust'
@@ -119,7 +122,7 @@ jobs:
119122
run: moodle-plugin-ci mustache
120123

121124
- name: Grunt
122-
if: ${{ always() }}
125+
if: ${{ matrix.moodle-branch == 'MOODLE_400_STABLE' }}
123126
run: moodle-plugin-ci grunt
124127

125128
- name: PHPUnit tests

tests/phpquestions_test.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
class phpquestions_test extends \qtype_coderunner_testcase {
4040

4141
public function test_good_sqr_function() {
42+
$this->check_language_available('php');
4243
$q = $this->make_question('sqrphp');
4344
$response = array('answer' => "<?php\nfunction sqr(\$n) { return \$n * \$n; }\n");
4445
list($mark, $grade, $cache) = $q->grade_response($response);
@@ -52,6 +53,7 @@ public function test_good_sqr_function() {
5253

5354

5455
public function test_bad_sqr_function() {
56+
$this->check_language_available('php');
5557
$q = $this->make_question('sqrphp');
5658
$response = array('answer' => "<?php\nfunction sqr(\$n) { return \$n; }\n");
5759
list($mark, $grade, $cache) = $q->grade_response($response);
@@ -65,6 +67,7 @@ public function test_bad_sqr_function() {
6567

6668

6769
public function test_bad_syntax() {
70+
$this->check_language_available('php');
6871
$q = $this->make_question('sqrphp');
6972
$response = array('answer' => "<?php\nfunction sqr(\$n) { return \$n\n");
7073
list($mark, $grade, $cache) = $q->grade_response($response);

tests/walkthrough_test.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2525
*/
2626

27-
use qtype_coderunner\constants;
28-
2927
namespace qtype_coderunner;
3028

3129
defined('MOODLE_INTERNAL') || die();

0 commit comments

Comments
 (0)