Revert "Issue #2759879 by klausi, claudiu.cristea, dawehner, Lendude, jibran: Additional assertions for WebAssert and AssertLegacyTrait, part 2"
This reverts commit 4bc34053d9
.
8.2.x
parent
4bc34053d9
commit
5c8dd621c7
|
@ -93,58 +93,6 @@ trait AssertLegacyTrait {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Passes if the text is found ONLY ONCE on the text version of the page.
|
||||
*
|
||||
* The text version is the equivalent of what a user would see when viewing
|
||||
* through a web browser. In other words the HTML has been filtered out of
|
||||
* the contents.
|
||||
*
|
||||
* @param string|\Drupal\Component\Render\MarkupInterface $text
|
||||
* Plain text to look for.
|
||||
* @param string $message
|
||||
* (optional) A message to display with the assertion. Do not translate
|
||||
* messages with t(). If left blank, a default message will be displayed.
|
||||
*
|
||||
* @deprecated Scheduled for removal in Drupal 9.0.0.
|
||||
* Use $this->getSession()->getPage()->getText() and substr_count() instead.
|
||||
*/
|
||||
protected function assertUniqueText($text, $message = NULL) {
|
||||
// Cast MarkupInterface objects to string.
|
||||
$text = (string) $text;
|
||||
|
||||
$message = $message ?: "'$text' found only once on the page";
|
||||
$page_text = $this->getSession()->getPage()->getText();
|
||||
$nr_found = substr_count($page_text, $text);
|
||||
$this->assertSame(1, $nr_found, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Passes if the text is found MORE THAN ONCE on the text version of the page.
|
||||
*
|
||||
* The text version is the equivalent of what a user would see when viewing
|
||||
* through a web browser. In other words the HTML has been filtered out of
|
||||
* the contents.
|
||||
*
|
||||
* @param string|\Drupal\Component\Render\MarkupInterface $text
|
||||
* Plain text to look for.
|
||||
* @param string $message
|
||||
* (optional) A message to display with the assertion. Do not translate
|
||||
* messages with t(). If left blank, a default message will be displayed.
|
||||
*
|
||||
* @deprecated Scheduled for removal in Drupal 9.0.0.
|
||||
* Use $this->getSession()->getPage()->getText() and substr_count() instead.
|
||||
*/
|
||||
protected function assertNoUniqueText($text, $message = '') {
|
||||
// Cast MarkupInterface objects to string.
|
||||
$text = (string) $text;
|
||||
|
||||
$message = $message ?: "'$text' found more than once on the page";
|
||||
$page_text = $this->getSession()->getPage()->getText();
|
||||
$nr_found = substr_count($page_text, $text);
|
||||
$this->assertGreaterThan(1, $nr_found, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts the page responds with the specified response code.
|
||||
*
|
||||
|
@ -180,27 +128,6 @@ trait AssertLegacyTrait {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that a field exists with the given name and value.
|
||||
*
|
||||
* @param string $name
|
||||
* Name of field to assert.
|
||||
* @param string $value
|
||||
* (optional) Value of the field to assert. You may pass in NULL (default)
|
||||
* to skip checking the actual value, while still checking that the field
|
||||
* exists.
|
||||
*
|
||||
* @deprecated Scheduled for removal in Drupal 9.0.0.
|
||||
* Use $this->assertSession()->fieldNotExists() or
|
||||
* $this->assertSession()->fieldValueNotEquals() instead.
|
||||
*/
|
||||
protected function assertNoFieldByName($name, $value = NULL) {
|
||||
$this->assertSession()->fieldNotExists($name);
|
||||
if ($value !== NULL) {
|
||||
$this->assertSession()->fieldValueNotEquals($name, (string) $value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that a field exists with the given ID and value.
|
||||
*
|
||||
|
@ -416,53 +343,6 @@ trait AssertLegacyTrait {
|
|||
return $this->assertSession()->optionNotExists($id, $option);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that a select option in the current page is checked.
|
||||
*
|
||||
* @param string $id
|
||||
* ID of select field to assert.
|
||||
* @param string $option
|
||||
* Option to assert.
|
||||
* @param string $message
|
||||
* (optional) A message to display with the assertion. Do not translate
|
||||
* messages with t(). If left blank, a default message will be displayed.
|
||||
*
|
||||
* @deprecated Scheduled for removal in Drupal 9.0.0.
|
||||
* Use $this->assertSession()->optionExists() instead and check the
|
||||
* "selected" attribute yourself.
|
||||
*/
|
||||
protected function assertOptionSelected($id, $option, $message = NULL) {
|
||||
$option_field = $this->assertSession()->optionExists($id, $option);
|
||||
$message = $message ?: "Option $option for field $id is selected.";
|
||||
$this->assertTrue($option_field->hasAttribute('selected'), $message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that a checkbox field in the current page is checked.
|
||||
*
|
||||
* @param string $id
|
||||
* ID of field to assert.
|
||||
*
|
||||
* @deprecated Scheduled for removal in Drupal 9.0.0.
|
||||
* Use $this->assertSession()->checkboxChecked() instead.
|
||||
*/
|
||||
protected function assertFieldChecked($id) {
|
||||
$this->assertSession()->checkboxChecked($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that a checkbox field in the current page is not checked.
|
||||
*
|
||||
* @param string $id
|
||||
* ID of field to assert.
|
||||
*
|
||||
* @deprecated Scheduled for removal in Drupal 9.0.0.
|
||||
* Use $this->assertSession()->checkboxNotChecked() instead.
|
||||
*/
|
||||
protected function assertNoFieldChecked($id) {
|
||||
$this->assertSession()->checkboxNotChecked($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Passes if the raw text IS found escaped on the loaded page, fail otherwise.
|
||||
*
|
||||
|
@ -493,19 +373,6 @@ trait AssertLegacyTrait {
|
|||
$this->assertSession()->assertNoEscaped($raw);
|
||||
}
|
||||
|
||||
/**
|
||||
* Triggers a pass if the Perl regex pattern is found in the raw content.
|
||||
*
|
||||
* @param string $pattern
|
||||
* Perl regex to look for including the regex delimiters.
|
||||
*
|
||||
* @deprecated Scheduled for removal in Drupal 9.0.0.
|
||||
* Use $this->assertSession()->responseMatches() instead.
|
||||
*/
|
||||
protected function assertPattern($pattern) {
|
||||
$this->assertSession()->responseMatches($pattern);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts whether an expected cache tag was present in the last response.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue