Skip to content

Commit

Permalink
Linting: linting code
Browse files Browse the repository at this point in the history
  • Loading branch information
WunderJacob committed Oct 9, 2024
1 parent 9c14bea commit 4e751b5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
14 changes: 7 additions & 7 deletions classes/coursesInstaller.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ protected function restore_course($coursefile, $precheck) {
* Recursively copies a directory.
*
* @param string $coursefile
* @param string $newcourseid
* @param object $newcourse
*/
protected function restore_with_controller($coursefile, $newcourse) {
global $USER, $CFG;
Expand All @@ -212,12 +212,12 @@ protected function restore_with_controller($coursefile, $newcourse) {

// Create the restore controller with the backup directory and the target course ID.
$rc = new restore_controller(
basename($restorepath), // Name of the backup file/folder
$newcourse->id, // Target course ID
backup::INTERACTIVE_NO, // No interactive mode
backup::MODE_IMPORT, // Mode import
$USER->id, // Current user ID
backup::TARGET_NEW_COURSE // Targeting a new course
basename($restorepath),
$newcourse->id,
backup::INTERACTIVE_NO,
backup::MODE_IMPORT,
$USER->id,
backup::TARGET_NEW_COURSE
);

if (!$rc->execute_precheck()) {
Expand Down
6 changes: 1 addition & 5 deletions tests/coursesinstaller_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public function test_restore_course() {
$recipe = ['path' => '/testcourses'];
$installer = $this->getMockBuilder(coursesInstaller::class)
->setConstructorArgs([$recipe])
->onlyMethods(['copy_directory', 'create_restore_controller'])
->onlyMethods(['copy_directory'])
->getMock();

// Mock the restore_controller.
Expand All @@ -206,10 +206,6 @@ public function test_restore_course() {
->method('copy_directory')
->willReturn(true);

$installer->expects($this->once())
->method('create_restore_controller')
->willReturn($mockrestorecontroller);

// Now call the restore_course method.
$reflection = new \ReflectionClass($installer);
$method = $reflection->getMethod('restore_course');
Expand Down

0 comments on commit 4e751b5

Please sign in to comment.