Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 310 and 311] [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403]

   1  <?php
   2  // This file is part of Moodle - http://moodle.org/
   3  //
   4  // Moodle is free software: you can redistribute it and/or modify
   5  // it under the terms of the GNU General Public License as published by
   6  // the Free Software Foundation, either version 3 of the License, or
   7  // (at your option) any later version.
   8  //
   9  // Moodle is distributed in the hope that it will be useful,
  10  // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12  // GNU General Public License for more details.
  13  //
  14  // You should have received a copy of the GNU General Public License
  15  // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
  16  
  17  /**
  18   * The Interface for a behat root context.
  19   *
  20   * @package    core
  21   * @category   test
  22   * @copyright  2020 Andrew Nicols <andrew@nicols.co.uk>
  23   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  24   */
  25  
  26  /**
  27   * The Interface for a behat root context.
  28   *
  29   * This interface should be implemented by the behat_base context, and behat form fields, and it should be paired with
  30   * the behat_session_trait.
  31   *
  32   * It should not be necessary to implement this interface, and the behat_session_trait trait in normal circumstances.
  33   *
  34   * @package    core
  35   * @category   test
  36   * @copyright  2020 Andrew Nicols <andrew@nicols.co.uk>
  37   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  38   */
  39  interface behat_session_interface {
  40      /**
  41       * Small timeout.
  42       *
  43       * A reduced timeout for cases where self::TIMEOUT is too much
  44       * and a simple $this->getSession()->getPage()->find() could not
  45       * be enough.
  46       *
  47       * @deprecated since Moodle 3.7 MDL-64979 - please use get_reduced_timeout() instead
  48       * @todo MDL-64982 This will be deleted in Moodle 3.11
  49       * @see behat_base::get_reduced_timeout()
  50       */
  51      const REDUCED_TIMEOUT = 2;
  52  
  53      /**
  54       * The timeout for each Behat step (load page, wait for an element to load...).
  55       *
  56       * @deprecated since Moodle 3.7 MDL-64979 - please use get_timeout() instead
  57       * @todo MDL-64982 This will be deleted in Moodle 3.11
  58       * @see behat_base::get_timeout()
  59       */
  60      const TIMEOUT = 6;
  61  
  62      /**
  63       * And extended timeout for specific cases.
  64       *
  65       * @deprecated since Moodle 3.7 MDL-64979 - please use get_extended_timeout() instead
  66       * @todo MDL-64982 This will be deleted in Moodle 3.11
  67       * @see behat_base::get_extended_timeout()
  68       */
  69      const EXTENDED_TIMEOUT = 10;
  70  
  71      /**
  72       * The JS code to check that the page is ready.
  73       *
  74       * The document must be complete and either M.util.pending_js must be empty, or it must not be defined at all.
  75       */
  76      const PAGE_READY_JS = "document.readyState === 'complete' && " .
  77          "(typeof M !== 'object' || typeof M.util !== 'object' || " .
  78          "typeof M.util.pending_js === 'undefined' || M.util.pending_js.length === 0)";
  79  
  80      /**
  81       * Returns the Mink session.
  82       *
  83       * @param   string|null $name name of the session OR active session will be used
  84       * @return  \Behat\Mink\Session
  85       */
  86      public function getSession($name = null);
  87  }