Skip to content

Commit

Permalink
MDL-77581 behat: Support finish_generate_ in generators
Browse files Browse the repository at this point in the history
  • Loading branch information
dpalou committed Nov 9, 2023
1 parent 5d44f11 commit a27cae4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/behat/classes/behat_generator_base.php
Expand Up @@ -279,6 +279,17 @@ public function generate_items(string $generatortype, TableNode $data, bool $sin
' data generator is not implemented');
}
}

// Notify that the all the elements have been generated.
if (method_exists($this->componentdatagenerator, 'finish_generate_' . $generatortype)) {
// Using the component's own data generator if it exists.
$this->componentdatagenerator->{'finish_generate_' . $generatortype}();

} else if (method_exists($this->datagenerator, 'finish_generate_' . $generatortype)) {
// Use a method on the core data geneator, if there is one.
$this->datagenerator->{'finish_generate_' . $generatortype}();

}
}

/**
Expand Down
1 change: 1 addition & 0 deletions lib/upgrade.txt
Expand Up @@ -6,6 +6,7 @@ information provided here is intended especially for developers.
(via options.pending). This is a backport of patch MDL-78779.
* Add a new parameter to the debounce (core/utils) function to allow for cancellation.
* Add a new method core_user::get_initials to get the initials of a user in a way compatible with internationalisation.
* Behat generators can now implement the function finish_generate_ to detect when the whole list of elements have been generated.

=== 4.2.3 ===
* \moodle_page::set_title() has been updated to append the site name depending on the value of $CFG->sitenameintitle and whether
Expand Down

0 comments on commit a27cae4

Please sign in to comment.