mirror of
https://github.com/moodle/moodle.git
synced 2025-06-04 23:25:35 +02:00
MDL-43236 behat: Deprecate old steps
Correcting grammar errors and deprecating the previous steps definitions: - behat_data_generators::the_following_exists() - behat_general::should_exists() - behat_general::should_not_exists()
This commit is contained in:
parent
0a489777fc
commit
c51c3b5575
@ -277,7 +277,7 @@ class behat_base extends Behat\MinkExtension\Context\RawMinkContext {
|
||||
* The arguments of the closure are mixed, use $args depending on your needs.
|
||||
*
|
||||
* You can provide an exception to give more accurate feedback to tests writers, otherwise the
|
||||
* closure exception will be used, but you must provide an exception if the closure does not throws
|
||||
* closure exception will be used, but you must provide an exception if the closure does not throw
|
||||
* an exception.
|
||||
*
|
||||
* @throws Exception If it timeouts without receiving something != false from the closure
|
||||
|
@ -136,14 +136,14 @@ class behat_data_generators extends behat_base {
|
||||
/**
|
||||
* Creates the specified element. More info about available elements in http://docs.moodle.org/dev/Acceptance_testing#Fixtures.
|
||||
*
|
||||
* @Given /^the following "(?P<element_string>(?:[^"]|\\")*)" exists:$/
|
||||
* @Given /^the following "(?P<element_string>(?:[^"]|\\")*)" exist:$/
|
||||
*
|
||||
* @throws Exception
|
||||
* @throws PendingException
|
||||
* @param string $elementname The name of the entity to add
|
||||
* @param TableNode $data
|
||||
*/
|
||||
public function the_following_exists($elementname, TableNode $data) {
|
||||
public function the_following_exist($elementname, TableNode $data) {
|
||||
|
||||
// Now that we need them require the data generators.
|
||||
require_once(__DIR__ . '/../../testing/generator/lib.php');
|
||||
|
@ -467,6 +467,54 @@ class behat_deprecated extends behat_base {
|
||||
return new Given($alternative, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the provided element and selector type exists in the current page.
|
||||
*
|
||||
* This step is for advanced users, use it if you don't find anything else suitable for what you need.
|
||||
*
|
||||
* @Then /^"(?P<element_string>(?:[^"]|\\")*)" "(?P<selector_string>[^"]*)" should exists$/
|
||||
* @throws ElementNotFoundException Thrown by behat_base::find
|
||||
* @param string $element The locator of the specified selector
|
||||
* @param string $selectortype The selector type
|
||||
*/
|
||||
public function should_exists($element, $selectortype) {
|
||||
$alternative = '"' . $this->escape($element) . '" "' . $this->escape($selectortype) . '" should exist';
|
||||
$this->deprecated_message($alternative);
|
||||
return new Then($alternative);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the provided element and selector type not exists in the current page.
|
||||
*
|
||||
* This step is for advanced users, use it if you don't find anything else suitable for what you need.
|
||||
*
|
||||
* @Then /^"(?P<element_string>(?:[^"]|\\")*)" "(?P<selector_string>[^"]*)" should not exists$/
|
||||
* @throws ExpectationException
|
||||
* @param string $element The locator of the specified selector
|
||||
* @param string $selectortype The selector type
|
||||
*/
|
||||
public function should_not_exists($element, $selectortype) {
|
||||
$alternative = '"' . $this->escape($element) . '" "' . $this->escape($selectortype) . '" should not exist';
|
||||
$this->deprecated_message($alternative);
|
||||
return new Then($alternative);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the specified element. More info about available elements in http://docs.moodle.org/dev/Acceptance_testing#Fixtures.
|
||||
*
|
||||
* @Given /^the following "(?P<element_string>(?:[^"]|\\")*)" exists:$/
|
||||
*
|
||||
* @throws Exception
|
||||
* @throws PendingException
|
||||
* @param string $elementname The name of the entity to add
|
||||
* @param TableNode $data
|
||||
*/
|
||||
public function the_following_exists($elementname, TableNode $data) {
|
||||
$alternative = 'the following "' . $this->escape($elementname) . '" exist';
|
||||
$this->deprecated_message($alternative);
|
||||
return new Given($alternative, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Throws an exception if $CFG->behat_usedeprecated is not allowed.
|
||||
*
|
||||
|
@ -767,12 +767,12 @@ class behat_general extends behat_base {
|
||||
*
|
||||
* This step is for advanced users, use it if you don't find anything else suitable for what you need.
|
||||
*
|
||||
* @Then /^"(?P<element_string>(?:[^"]|\\")*)" "(?P<selector_string>[^"]*)" should exists$/
|
||||
* @Then /^"(?P<element_string>(?:[^"]|\\")*)" "(?P<selector_string>[^"]*)" should exist$/
|
||||
* @throws ElementNotFoundException Thrown by behat_base::find
|
||||
* @param string $element The locator of the specified selector
|
||||
* @param string $selectortype The selector type
|
||||
*/
|
||||
public function should_exists($element, $selectortype) {
|
||||
public function should_exist($element, $selectortype) {
|
||||
|
||||
// Getting Mink selector and locator.
|
||||
list($selector, $locator) = $this->transform_selector($selectortype, $element);
|
||||
@ -786,12 +786,12 @@ class behat_general extends behat_base {
|
||||
*
|
||||
* This step is for advanced users, use it if you don't find anything else suitable for what you need.
|
||||
*
|
||||
* @Then /^"(?P<element_string>(?:[^"]|\\")*)" "(?P<selector_string>[^"]*)" should not exists$/
|
||||
* @Then /^"(?P<element_string>(?:[^"]|\\")*)" "(?P<selector_string>[^"]*)" should not exist$/
|
||||
* @throws ExpectationException
|
||||
* @param string $element The locator of the specified selector
|
||||
* @param string $selectortype The selector type
|
||||
*/
|
||||
public function should_not_exists($element, $selectortype) {
|
||||
public function should_not_exist($element, $selectortype) {
|
||||
|
||||
// Getting Mink selector and locator.
|
||||
list($selector, $locator) = $this->transform_selector($selectortype, $element);
|
||||
|
@ -137,7 +137,7 @@ class behat_permissions extends behat_base {
|
||||
// Converting from permission to constant value.
|
||||
$permissionvalue = constant($permissionconstant);
|
||||
|
||||
// Here we wait for the element to appear and exception if it does not exists.
|
||||
// Here we wait for the element to appear and exception if it does not exist.
|
||||
$radio = $this->find('xpath', '//input[@name="' . $capability . '" and @value="' . $permissionvalue . '"]');
|
||||
$radio->click();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user