Moodle PHP Documentation 4.4
Moodle 4.4.1 (Build: 20240610) (db07c09afc5)
behat_backup Class Reference

Backup-related steps definitions. More...

Inheritance diagram for behat_backup:
behat_base behat_session_interface

Public Member Functions

 getSession ($name=null)
 Returns the Mink session.
 
 i_backup_course_using_this_options ($backupcourse, $options=false)
 Backups the specified course using the provided options.
 
 i_import_course_into_course ($fromcourse, $tocourse, $options=false)
 Imports the specified origin course into the other course using the provided options.
 
 i_merge_backup_into_current_course_deleting_its_contents ($backupfilename, $options=false)
 Merges the backup into the current course after deleting this contents, using the provided restore options.
 
 i_merge_backup_into_the_current_course ($backupfilename, $options=false)
 Merges the backup into the current course using the provided restore options.
 
 i_perform_a_quick_backup_of_course ($backupcourse)
 Performs a quick (one click) backup of a course.
 
 i_restore_backup_into_a_new_course_using_this_options ($backupfilename, $options=false)
 Restores the specified backup into a new course using the provided options.
 
 i_restore_backup_into_course_using_this_options ($backupfilename, $existingcourse, $options=false)
 Restores the backup into the specified course and the provided options.
 

Public Attributes

const PAGE_READY_JS
 The JS code to check that the page is ready.
 

Protected Member Functions

 fill_backup_restore_form ($options)
 Tries to fill the current page form elements with the provided options.
 
 get_step_options ($options, $step)
 Get the options specific to this step of the backup/restore process.
 
 process_restore ($options)
 Executes the common steps of all restore processes.
 
 select_backup ($backupfilename)
 Selects the backup to restore.
 

Detailed Description

Backup-related steps definitions.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Member Function Documentation

◆ fill_backup_restore_form()

behat_backup::fill_backup_restore_form ( $options)
protected

Tries to fill the current page form elements with the provided options.

This step is slow as it spins over each provided option, we are not expected to have lots of provided options, anyways, is better to be conservative and wait for the elements to appear rather than to have false failures.

Parameters
TableNode$optionsThe backup and restore options or false if no options provided
Return values
void

◆ get_step_options()

behat_backup::get_step_options ( $options,
$step )
protected

Get the options specific to this step of the backup/restore process.

Parameters
TableNode$optionsThe options table to filter
string$stepThe name of the step
Return values
TableNodeThe filtered options table
Exceptions
ExpectationException

◆ getSession()

behat_session_interface::getSession ( $name = null)
inherited

Returns the Mink session.

Parameters
string | null$namename of the session OR active session will be used
Return values
Behat\Mink\Session

Implemented in behat_form_field.

◆ i_backup_course_using_this_options()

behat_backup::i_backup_course_using_this_options ( $backupcourse,
$options = false )

Backups the specified course using the provided options.

If you are interested in restoring this backup would be useful to provide a 'Filename' option.

@Given /^I backup "(?P<course_fullname_string>(?:[^"]|::")*)" course using this options:$/

Parameters
string$backupcourse
TableNode$optionsBackup options or false if no options provided

◆ i_import_course_into_course()

behat_backup::i_import_course_into_course ( $fromcourse,
$tocourse,
$options = false )

Imports the specified origin course into the other course using the provided options.

Keeping it separatelly from backup & restore, it the number of steps and duplicate code becomes bigger a common method should be generalized.

@Given /^I import "(?P<from_course_fullname_string>(?:[^"]|::")*)" course into "(?P<to_course_fullname_string>(?:[^"]|")*)" course using this options:$/

Parameters
string$fromcourse
string$tocourse
TableNode$options

◆ i_merge_backup_into_current_course_deleting_its_contents()

behat_backup::i_merge_backup_into_current_course_deleting_its_contents ( $backupfilename,
$options = false )

Merges the backup into the current course after deleting this contents, using the provided restore options.

You should be in the 'Restore' page where the backup is.

@Given /^I merge "(?P<backup_filename_string>(?:[^"]|::")*)" backup into the current course after deleting it's contents using this options:$/

Parameters
string$backupfilename
TableNode$optionsRestore forms options or false if no options provided

◆ i_merge_backup_into_the_current_course()

behat_backup::i_merge_backup_into_the_current_course ( $backupfilename,
$options = false )

Merges the backup into the current course using the provided restore options.

You should be in the 'Restore' page where the backup is.

@Given /^I merge "(?P<backup_filename_string>(?:[^"]|::")*)" backup into the current course using this options:$/

Parameters
string$backupfilename
TableNode$optionsRestore forms options or false if no options provided

◆ i_perform_a_quick_backup_of_course()

behat_backup::i_perform_a_quick_backup_of_course ( $backupcourse)

Performs a quick (one click) backup of a course.

Please note that because you can't set settings with this there is no way to know what the filename that was produced was. It contains a timestamp making it hard to find.

@Given /^I perform a quick backup of course "(?P<course_fullname_string>(?:[^"]|::")*)"$/

Parameters
string$backupcourse

◆ i_restore_backup_into_a_new_course_using_this_options()

behat_backup::i_restore_backup_into_a_new_course_using_this_options ( $backupfilename,
$options = false )

Restores the specified backup into a new course using the provided options.

You should be in the 'Restore' page where the backup is.

@Given /^I restore "(?P<backup_filename_string>(?:[^"]|::")*)" backup into a new course using this options:$/

Parameters
string$backupfilename
TableNode$optionsRestore forms options or false if no options provided

◆ i_restore_backup_into_course_using_this_options()

behat_backup::i_restore_backup_into_course_using_this_options ( $backupfilename,
$existingcourse,
$options = false )

Restores the backup into the specified course and the provided options.

You should be in the 'Restore' page where the backup is.

@Given /^I restore "(?P<backup_filename_string>(?:[^"]|::")*)" backup into "(?P<existing_course_fullname_string>(?:[^"]|")*)" course using this options:$/

Parameters
string$backupfilename
string$existingcourse
TableNode$optionsRestore forms options or false if no options provided

◆ process_restore()

behat_backup::process_restore ( $options)
protected

Executes the common steps of all restore processes.

Parameters
TableNode$optionsThe backup and restore options or false if no options provided
Return values
void

◆ select_backup()

behat_backup::select_backup ( $backupfilename)
protected

Selects the backup to restore.

Exceptions
ExpectationException
Parameters
string$backupfilename
Return values
void

Member Data Documentation

◆ PAGE_READY_JS

const behat_session_interface::PAGE_READY_JS
inherited
Initial value:
= "document.readyState === 'complete' && " .
"(typeof M !== 'object' || typeof M.util !== 'object' || " .
"typeof M.util.pending_js === 'undefined' || M.util.pending_js.length === 0)"

The JS code to check that the page is ready.

The document must be complete and either M.util.pending_js must be empty, or it must not be defined at all.


The documentation for this class was generated from the following file: