Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
Public Member Functions | Public Attributes | Protected Member Functions | List of all members
behat_backup Class Reference
Inheritance diagram for behat_backup:
behat_base behat_session_interface

Public Member Functions

 getSession ($name=null)
 Returns the Mink session. More...
 
 i_backup_course_using_this_options ($backupcourse, $options=false)
 Backups the specified course using the provided options. More...
 
 i_import_course_into_course ($fromcourse, $tocourse, $options=false)
 Imports the specified origin course into the other course using the provided options. More...
 
 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. More...
 
 i_merge_backup_into_the_current_course ($backupfilename, $options=false)
 Merges the backup into the current course using the provided restore options. More...
 
 i_perform_a_quick_backup_of_course ($backupcourse)
 Performs a quick (one click) backup of a course. More...
 
 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. More...
 
 i_restore_backup_into_course_using_this_options ($backupfilename, $existingcourse, $options=false)
 Restores the backup into the specified course and the provided options. More...
 

Public Attributes

const EXTENDED_TIMEOUT = 10
 And extended timeout for specific cases. More...
 
const PAGE_READY_JS
 The JS code to check that the page is ready. More...
 
const REDUCED_TIMEOUT = 2
 Small timeout. More...
 
const TIMEOUT = 6
 The timeout for each Behat step (load page, wait for an element to load...). More...
 

Protected Member Functions

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

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

◆ EXTENDED_TIMEOUT

const behat_session_interface::EXTENDED_TIMEOUT = 10
inherited

And extended timeout for specific cases.

Deprecated:
since Moodle 3.7 MDL-64979 - please use get_extended_timeout() instead
Todo:
MDL-64982 This will be deleted in Moodle 3.11
See also
behat_base::get_extended_timeout()

◆ 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.

◆ REDUCED_TIMEOUT

const behat_session_interface::REDUCED_TIMEOUT = 2
inherited

Small timeout.

A reduced timeout for cases where self::TIMEOUT is too much and a simple $this->getSession()->getPage()->find() could not be enough.

Deprecated:
since Moodle 3.7 MDL-64979 - please use get_reduced_timeout() instead
Todo:
MDL-64982 This will be deleted in Moodle 3.11
See also
behat_base::get_reduced_timeout()

◆ TIMEOUT

const behat_session_interface::TIMEOUT = 6
inherited

The timeout for each Behat step (load page, wait for an element to load...).

Deprecated:
since Moodle 3.7 MDL-64979 - please use get_timeout() instead
Todo:
MDL-64982 This will be deleted in Moodle 3.11
See also
behat_base::get_timeout()

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