MDL-83035 behat: deprecate admin presets behat steps

Signed-off-by: Daniel Ziegenberg <[email protected]>
This commit is contained in:
Daniel Ziegenberg
2025-01-21 13:39:42 +01:00
parent a2653cc924
commit 08ca969323
2 changed files with 21 additions and 3 deletions
@@ -0,0 +1,7 @@
issueNumber: MDL-83035
notes:
tool_admin_presets:
- message: >-
behat_admin_presets::following_in_the_should_download_between_and_bytes
is deprecated. Use: the following element should download a file that:
type: deprecated
@@ -26,21 +26,22 @@
// NOTE: no MOODLE_INTERNAL test here, this file may be required by behat before including /config.php.
require_once(__DIR__ . '/../../../../../lib/behat/behat_base.php');
require_once(__DIR__ . '/../../../../../lib/behat/behat_deprecated_base.php');
require_once(__DIR__ . '/../../../../../lib/behat/behat_field_manager.php');
use Behat\Mink\Exception\ExpectationException as ExpectationException;
/**
* Steps definitions related with admin presets.
* Steps definitions that are now deprecated and will be removed in the next releases.
*
* @package tool_admin_presets
* @category test
* @copyright 2021 Pimenko <support@pimenko.com><pimenko.com>
* @author Sylvain Revenu | Pimenko
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @todo MDL-78077 This will be deleted in Moodle 6.0.
*/
class behat_admin_presets extends behat_base {
class behat_admin_presets_deprecated extends behat_deprecated_base {
/**
* Downloads the file from a specific link on the page and checks the size is in a given range.
@@ -60,9 +61,14 @@ class behat_admin_presets extends behat_base {
* @param int $maxexpectedsize the maximum expected file size in bytes.
* @return void
* @throws ExpectationException
* @deprecated since 5.0
*/
final public function following_in_the_should_download_between_and_bytes(string $link, string $selectortype,
string $nodeelement, string $nodeselectortype, int $minexpectedsize, int $maxexpectedsize): void {
$this->deprecated_message("behat_admin_presets::following_in_the_should_download_between_and_bytes
is deprecated. Use: the following element should download a file that:");
// If the minimum is greater than the maximum then swap the values.
if ((int) $minexpectedsize > (int) $maxexpectedsize) {
list($minexpectedsize, $maxexpectedsize) = [$maxexpectedsize, $minexpectedsize];
@@ -105,9 +111,14 @@ class behat_admin_presets extends behat_base {
* @param string $nodeselectortype The type of selector where we look in
* @param string $nodeelement Element we look in
* @return string the content of the downloaded file.
* @deprecated since 5.0
*/
final public function download_file_from_link_within_node(string $selectortype, string $link,
string $nodeselectortype, string $nodeelement): string {
$this->deprecated_message("behat_admin_presets::following_in_the_should_download_between_and_bytes
is deprecated. Use: the following element should download a file that:");
// Find the link from ur specific node.
$linknode = $this->get_node_in_container($selectortype, $link, $nodeselectortype, $nodeelement);
$this->ensure_node_is_visible($linknode);