Skip to content

Commit

Permalink
quiz-data - Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
EJMFarrow committed Dec 10, 2024
1 parent c93a91b commit c4905d6
Show file tree
Hide file tree
Showing 13 changed files with 20 additions and 8 deletions.
2 changes: 1 addition & 1 deletion classes/export_repo.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ public function __construct(cli_helper $clihelper, array $moodleinstances) {
// (Moodle code rules don't allow 'extract()').
$arguments = $clihelper->get_arguments();
$moodleinstance = $arguments['moodleinstance'];
$this->moodleurl = $moodleinstances[$moodleinstance];
$this->usegit = $arguments['usegit'];
$defaultwarning = false;
$this->manifestpath = ($arguments['rootdirectory']) ? $arguments['rootdirectory'] . '/' . $arguments['manifestpath'] :
Expand Down Expand Up @@ -165,7 +166,6 @@ public function __construct(cli_helper $clihelper, array $moodleinstances) {
$this->tempfilepath = str_replace(cli_helper::MANIFEST_FILE,
'_export' . cli_helper::TEMP_MANIFEST_FILE,
$this->manifestpath);
$this->moodleurl = $moodleinstances[$moodleinstance];
$wsurl = $this->moodleurl . '/webservice/rest/server.php';

$this->curlrequest = $this->get_curl_request($wsurl);
Expand Down
1 change: 1 addition & 0 deletions doc/exportrepofrommoodle.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
|-|-|-|
|i|moodleinstance|Key of Moodle instance in $moodleinstances to use. Should match end of instance URL.|
|r|rootdirectory|Directory on user's computer containing repos.|
|f|nonquizmanifestpath|Filepath of non-quiz manifest file relative to root directory.|
|f|manifestpath|Filepath of manifest file relative to root directory.|
|s|subcategory|Relative subcategory of repo to actually export.|
|q|questioncategoryid|Numerical id of subcategory to actually export.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"coursecategory": "",
"instanceid": "",
"defaultsubdirectory": "top\/cat-2",
"defaultsubcategoryid": 5
"defaultsubcategoryid": 5,
"moodleurl": "fakeurl.com"
},
"questions": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"coursecategory": "",
"instanceid": "",
"defaultsubdirectory": "top\/cat-2",
"defaultsubcategoryid": 5
"defaultsubcategoryid": 5,
"moodleurl": "fakeurl.com"
},
"questions": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"instanceid": "",
"defaultsubdirectory": "top\/cat-2",
"defaultsubcategoryid": 5,
"defaultignorecat": "/subcat 2_1/"
"defaultignorecat": "/subcat 2_1/",
"moodleurl": "fakeurl.com"
},
"questions": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"coursecategory": "",
"instanceid": "",
"defaultsubdirectory": "top\/cat-2",
"defaultsubcategoryid": 5
"defaultsubcategoryid": 5,
"moodleurl": "fakeurl.com"
},
"questions": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"coursecategory": "",
"instanceid": "5",
"defaultsubdirectory": "top\/cat-2",
"defaultsubcategoryid": 5
"defaultsubcategoryid": 5,
"moodleurl": "fakeurl.com"
},
"questions": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"coursecategory": "",
"instanceid": "",
"defaultsubdirectory": "top",
"defaultsubcategoryid": 5
"defaultsubcategoryid": 5,
"moodleurl": "fakeurl.com"
},
"questions": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"coursecategory": "",
"instanceid": "1",
"defaultsubdirectory": "top",
"defaultsubcategoryid": 5
"defaultsubcategoryid": 5,
"moodleurl": "fakeurl.com"
},
"questions": [
{
Expand Down
1 change: 1 addition & 0 deletions tests/create_repo_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public function setUp(): void {
'rootdirectory' => $this->rootpath,
'directory' => '',
'subcategory' => null,
'nonquizmanifestpath' => null,
'contextlevel' => 'system',
'coursename' => 'Course 1',
'modulename' => 'Test 1',
Expand Down
1 change: 1 addition & 0 deletions tests/export_repo_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ public function setUp(): void {
$this->options = [
'moodleinstance' => self::MOODLE,
'rootdirectory' => $this->rootpath,
'nonquizmanifestpath' => null,
'subcategory' => null,
'qcategoryid' => null,
'manifestpath' => '/' . self::MOODLE . '_system' . cli_helper::MANIFEST_FILE,
Expand Down
1 change: 1 addition & 0 deletions tests/export_trait_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public function setUp(): void {
$this->options = [
'moodleinstance' => self::MOODLE,
'rootdirectory' => $this->rootpath,
'nonquizmanifestpath' => null,
'subcategory' => null,
'qcategoryid' => null,
'manifestpath' => '/' . self::MOODLE . '_system' . cli_helper::MANIFEST_FILE,
Expand Down
1 change: 1 addition & 0 deletions tests/tidy_trait_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public function setUp(): void {
'moodleinstance' => self::MOODLE,
'rootdirectory' => $this->rootpath,
'subcategory' => 'top',
'nonquizmanifestpath' => null,
'qcategoryid' => null,
'manifestpath' => '/' . self::MOODLE . '_system' . cli_helper::MANIFEST_FILE,
'token' => 'XXXXXX',
Expand Down

0 comments on commit c4905d6

Please sign in to comment.