Unverified Commit 5e395126 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3104372 by Gábor Hojtsy, mondrake, longwave, andypost, catch: Fix...

Issue #3104372 by Gábor Hojtsy, mondrake, longwave, andypost, catch: Fix Drupal\FunctionalTests\AssertLegacyTrait inconsistent deprecation messages
parent 78db4120
Loading
Loading
Loading
Loading
+103 −101
Original line number Diff line number Diff line
@@ -12,16 +12,16 @@
/**
 * Provides convenience methods for assertions in browser tests.
 *
 * Deprecated Scheduled for removal in Drupal 10.0.0. Use the methods on
 *   \Drupal\Tests\WebAssert instead, for example
 * Deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use
 *   the methods on \Drupal\Tests\WebAssert instead, for example
 * @code
 *    $this->assertSession()->statusCodeEquals(200);
 * @endcode
 *
 * @todo https://www.drupal.org/project/drupal/issues/3031580 Note that
 * @todo https://www.drupal.org/project/drupal/issues/3114617 Note that
 *   deprecations in this file do not use the @ symbol in Drupal 8 because this
 *   will be removed in Drupal 10.0.0. Adding the @ back should re-enable coding
 *   stanadrds checks.
 *   standards checks.
 */
trait AssertLegacyTrait {

@@ -33,8 +33,8 @@ trait AssertLegacyTrait {
   * @param string $css_selector
   *   The CSS selector identifying the element to check.
   *
   * Deprecated Scheduled for removal in Drupal 10.0.0.
   *   Use $this->assertSession()->elementExists() instead.
   * Deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use
   *   $this->assertSession()->elementExists() instead.
   */
  protected function assertElementPresent($css_selector) {
    $this->assertSession()->elementExists('css', $css_selector);
@@ -46,8 +46,8 @@ protected function assertElementPresent($css_selector) {
   * @param string $css_selector
   *   The CSS selector identifying the element to check.
   *
   * Deprecated Scheduled for removal in Drupal 10.0.0.
   *   Use $this->assertSession()->elementNotExists() instead.
   * Deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use
   *   $this->assertSession()->elementNotExists() instead.
   */
  protected function assertElementNotPresent($css_selector) {
    $this->assertSession()->elementNotExists('css', $css_selector);
@@ -62,8 +62,7 @@ protected function assertElementNotPresent($css_selector) {
   * @param string $text
   *   Plain text to look for.
   *
   * Deprecated Scheduled for removal in Drupal 10.0.0.
   *   Use instead:
   * Deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use
   *   - $this->assertSession()->responseContains() for non-HTML responses,
   *     like XML or Json.
   *   - $this->assertSession()->pageTextContains() for HTML responses. Unlike
@@ -94,8 +93,7 @@ protected function assertText($text) {
   * @param string $text
   *   Plain text to look for.
   *
   * Deprecated Scheduled for removal in Drupal 10.0.0.
   *   Use instead:
   * Deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use
   *   - $this->assertSession()->responseNotContains() for non-HTML responses,
   *     like XML or Json.
   *   - $this->assertSession()->pageTextNotContains() for HTML responses.
@@ -160,8 +158,8 @@ protected function assertTextHelper($text, $not_exists = TRUE) {
   *   (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 10.0.0.
   *   Use $this->getSession()->getPage()->getText() and substr_count() instead.
   * Deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use
   *   $this->getSession()->getPage()->getText() and substr_count() instead.
   */
  protected function assertUniqueText($text, $message = NULL) {
    // Cast MarkupInterface objects to string.
@@ -186,8 +184,8 @@ protected function assertUniqueText($text, $message = NULL) {
   *   (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 10.0.0.
   *   Use $this->getSession()->getPage()->getText() and substr_count() instead.
   * Deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use
   *   $this->getSession()->getPage()->getText() and substr_count() instead.
   */
  protected function assertNoUniqueText($text, $message = '') {
    // Cast MarkupInterface objects to string.
@@ -206,8 +204,8 @@ protected function assertNoUniqueText($text, $message = '') {
   *   Response code. For example 200 is a successful page request. For a list
   *   of all codes see http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html.
   *
   * Deprecated Scheduled for removal in Drupal 10.0.0.
   *   Use $this->assertSession()->statusCodeEquals() instead.
   * Deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use
   *   $this->assertSession()->statusCodeEquals() instead.
   */
  protected function assertResponse($code) {
    $this->assertSession()->statusCodeEquals($code);
@@ -223,8 +221,8 @@ protected function assertResponse($code) {
   *   to skip checking the actual value, while still checking that the field
   *   exists.
   *
   * Deprecated Scheduled for removal in Drupal 10.0.0.
   *   Use $this->assertSession()->fieldExists() or
   * Deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use
   *   $this->assertSession()->fieldExists() or
   *   $this->assertSession()->buttonExists() or
   *   $this->assertSession()->fieldValueEquals() instead.
   */
@@ -243,8 +241,8 @@ protected function assertFieldByName($name, $value = NULL) {
   *   value, while still checking that the field does not exist. However, the
   *   default value ('') asserts that the field value is not an empty string.
   *
   * Deprecated Scheduled for removal in Drupal 10.0.0.
   *   Use $this->assertSession()->fieldNotExists() or
   * Deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use
   *   $this->assertSession()->fieldNotExists() or
   *   $this->assertSession()->buttonNotExists() or
   *   $this->assertSession()->fieldValueNotEquals() instead.
   */
@@ -265,8 +263,8 @@ protected function assertNoFieldByName($name, $value = '') {
   *
   * @throws \Behat\Mink\Exception\ElementNotFoundException
   *
   * Deprecated Scheduled for removal in Drupal 10.0.0.
   *   Use $this->assertSession()->fieldExists() or
   * Deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use
   *   $this->assertSession()->fieldExists() or
   *   $this->assertSession()->buttonExists() or
   *   $this->assertSession()->fieldValueEquals() instead.
   */
@@ -280,8 +278,8 @@ protected function assertFieldById($id, $value = '') {
   * @param string $field
   *   Name or ID of field to assert.
   *
   * Deprecated Scheduled for removal in Drupal 10.0.0.
   *   Use $this->assertSession()->fieldExists() or
   * Deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use
   *   $this->assertSession()->fieldExists() or
   *   $this->assertSession()->buttonExists() instead.
   */
  protected function assertField($field) {
@@ -294,8 +292,8 @@ protected function assertField($field) {
   * @param string $field
   *   Name or ID of field to assert.
   *
   * Deprecated Scheduled for removal in Drupal 10.0.0.
   *   Use $this->assertSession()->fieldNotExists() or
   * Deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use
   *   $this->assertSession()->fieldNotExists() or
   *   $this->assertSession()->buttonNotExists() instead.
   */
  protected function assertNoField($field) {
@@ -310,8 +308,8 @@ protected function assertNoField($field) {
   * @param string $raw
   *   Raw (HTML) string to look for.
   *
   * Deprecated Scheduled for removal in Drupal 10.0.0.
   *   Use $this->assertSession()->responseContains() instead.
   * Deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use
   *   $this->assertSession()->responseContains() instead.
   */
  protected function assertRaw($raw) {
    $this->assertSession()->responseContains($raw);
@@ -325,8 +323,8 @@ protected function assertRaw($raw) {
   * @param string $raw
   *   Raw (HTML) string to look for.
   *
   * Deprecated Scheduled for removal in Drupal 10.0.0.
   *   Use $this->assertSession()->responseNotContains() instead.
   * Deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use
   *   $this->assertSession()->responseNotContains() instead.
   */
  protected function assertNoRaw($raw) {
    $this->assertSession()->responseNotContains($raw);
@@ -338,8 +336,8 @@ protected function assertNoRaw($raw) {
   * @param string $expected_title
   *   The string the page title should be.
   *
   * Deprecated Scheduled for removal in Drupal 10.0.0.
   *   Use $this->assertSession()->titleEquals() instead.
   * Deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use
   *   $this->assertSession()->titleEquals() instead.
   */
  protected function assertTitle($expected_title) {
    // Cast MarkupInterface to string.
@@ -357,8 +355,8 @@ protected function assertTitle($expected_title) {
   * @param int $index
   *   Link position counting from zero.
   *
   * Deprecated Scheduled for removal in Drupal 10.0.0.
   *   Use $this->assertSession()->linkExists() instead.
   * Deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use
   *   $this->assertSession()->linkExists() instead.
   */
  protected function assertLink($label, $index = 0) {
    return $this->assertSession()->linkExists($label, $index);
@@ -370,8 +368,8 @@ protected function assertLink($label, $index = 0) {
   * @param string|\Drupal\Component\Render\MarkupInterface $label
   *   Text between the anchor tags.
   *
   * Deprecated Scheduled for removal in Drupal 10.0.0.
   *   Use $this->assertSession()->linkNotExists() instead.
   * Deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use
   *   $this->assertSession()->linkNotExists() instead.
   */
  protected function assertNoLink($label) {
    return $this->assertSession()->linkNotExists($label);
@@ -385,8 +383,8 @@ protected function assertNoLink($label) {
   * @param int $index
   *   Link position counting from zero.
   *
   * Deprecated Scheduled for removal in Drupal 10.0.0.
   *   Use $this->assertSession()->linkByHrefExists() instead.
   * Deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use
   *   $this->assertSession()->linkByHrefExists() instead.
   */
  protected function assertLinkByHref($href, $index = 0) {
    $this->assertSession()->linkByHrefExists($href, $index);
@@ -398,8 +396,8 @@ protected function assertLinkByHref($href, $index = 0) {
   * @param string $href
   *   The full or partial value of the 'href' attribute of the anchor tag.
   *
   * Deprecated Scheduled for removal in Drupal 10.0.0.
   *   Use $this->assertSession()->linkByHrefNotExists() instead.
   * Deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use
   *   $this->assertSession()->linkByHrefNotExists() instead.
   */
  protected function assertNoLinkByHref($href) {
    $this->assertSession()->linkByHrefNotExists($href);
@@ -418,8 +416,8 @@ protected function assertNoLinkByHref($href) {
   *
   * @throws \Behat\Mink\Exception\ExpectationException
   *
   * Deprecated Scheduled for removal in Drupal 10.0.0.
   *   Use $this->assertSession()->fieldNotExists() or
   * Deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use
   *   $this->assertSession()->fieldNotExists() or
   *   $this->assertSession()->buttonNotExists() or
   *   $this->assertSession()->fieldValueNotEquals() instead.
   */
@@ -433,8 +431,8 @@ protected function assertNoFieldById($id, $value = '') {
   * @param \Drupal\Core\Url|string $path
   *   The expected system path or URL.
   *
   * Deprecated Scheduled for removal in Drupal 10.0.0.
   *   Use $this->assertSession()->addressEquals() instead.
   * Deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use
   *   $this->assertSession()->addressEquals() instead.
   */
  protected function assertUrl($path) {
    $this->assertSession()->addressEquals($path);
@@ -448,8 +446,8 @@ protected function assertUrl($path) {
   * @param string $option
   *   Option to assert.
   *
   * Deprecated Scheduled for removal in Drupal 10.0.0.
   *   Use $this->assertSession()->optionExists() instead.
   * Deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use
   *   $this->assertSession()->optionExists() instead.
   */
  protected function assertOption($id, $option) {
    return $this->assertSession()->optionExists($id, $option);
@@ -463,8 +461,8 @@ protected function assertOption($id, $option) {
   * @param string $text
   *   The text for the option tag to assert.
   *
   * Deprecated Scheduled for removal in Drupal 10.0.0.
   *   Use $this->assertSession()->optionExists() instead.
   * Deprecated in drupal:8.4.0 and is removed from drupal:10.0.0. Use
   *   $this->assertSession()->optionExists() instead.
   */
  protected function assertOptionByText($id, $text) {
    return $this->assertSession()->optionExists($id, $text);
@@ -478,8 +476,8 @@ protected function assertOptionByText($id, $text) {
   * @param string $option
   *   Option to assert.
   *
   * Deprecated Scheduled for removal in Drupal 10.0.0.
   *   Use $this->assertSession()->optionNotExists() instead.
   * Deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use
   *   $this->assertSession()->optionNotExists() instead.
   */
  protected function assertNoOption($id, $option) {
    return $this->assertSession()->optionNotExists($id, $option);
@@ -496,8 +494,8 @@ protected function assertNoOption($id, $option) {
   *   (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 10.0.0.
   *   Use $this->assertSession()->optionExists() instead and check the
   * Deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use
   *   $this->assertSession()->optionExists() instead and check the
   *   "selected" attribute yourself.
   */
  protected function assertOptionSelected($id, $option, $message = NULL) {
@@ -512,8 +510,8 @@ protected function assertOptionSelected($id, $option, $message = NULL) {
   * @param string $id
   *   ID of field to assert.
   *
   * Deprecated Scheduled for removal in Drupal 10.0.0.
   *   Use $this->assertSession()->checkboxChecked() instead.
   * Deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use
   *   $this->assertSession()->checkboxChecked() instead.
   */
  protected function assertFieldChecked($id) {
    $this->assertSession()->checkboxChecked($id);
@@ -525,8 +523,8 @@ protected function assertFieldChecked($id) {
   * @param string $id
   *   ID of field to assert.
   *
   * Deprecated Scheduled for removal in Drupal 10.0.0.
   *   Use $this->assertSession()->checkboxNotChecked() instead.
   * Deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use
   *   $this->assertSession()->checkboxNotChecked() instead.
   */
  protected function assertNoFieldChecked($id) {
    $this->assertSession()->checkboxNotChecked($id);
@@ -545,8 +543,8 @@ protected function assertNoFieldChecked($id) {
   *   (optional) A message to display with the assertion. Do not translate
   *   messages with t().
   *
   * Deprecated Scheduled for removal in Drupal 10.0.0.
   *   Use $this->xpath() instead and check the values directly in the test.
   * Deprecated in drupal:8.3.0 and is removed from drupal:10.0.0. Use
   *   $this->xpath() instead and check the values directly in the test.
   */
  protected function assertFieldByXPath($xpath, $value = NULL, $message = '') {
    $fields = $this->xpath($xpath);
@@ -568,8 +566,8 @@ protected function assertFieldByXPath($xpath, $value = NULL, $message = '') {
   *
   * @throws \Behat\Mink\Exception\ExpectationException
   *
   * Deprecated Scheduled for removal in Drupal 10.0.0.
   *   Use $this->xpath() instead and assert that the result is empty.
   * Deprecated in drupal:8.3.0 and is removed from drupal:10.0.0. Use
   *   $this->xpath() instead and assert that the result is empty.
   */
  protected function assertNoFieldByXPath($xpath, $value = NULL, $message = '') {
    $fields = $this->xpath($xpath);
@@ -606,9 +604,9 @@ protected function assertNoFieldByXPath($xpath, $value = NULL, $message = '') {
   *   (optional) A message to display with the assertion. Do not translate
   *   messages with t().
   *
   * Deprecated Scheduled for removal in Drupal 10.0.0.
   *   Iterate over the fields yourself instead and directly check the values in
   *   the test.
   * Deprecated in drupal:8.3.0 and is removed from drupal:10.0.0. Use
   *   iteration over the fields yourself instead and directly check the values
   *   in the test.
   */
  protected function assertFieldsByValue($fields, $value = NULL, $message = '') {
    // If value specified then check array for match.
@@ -655,8 +653,8 @@ protected function assertFieldsByValue($fields, $value = NULL, $message = '') {
   * @param string $raw
   *   Raw (HTML) string to look for.
   *
   * Deprecated Scheduled for removal in Drupal 10.0.0.
   *   Use $this->assertSession()->assertEscaped() instead.
   * Deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use
   *   $this->assertSession()->assertEscaped() instead.
   */
  protected function assertEscaped($raw) {
    $this->assertSession()->assertEscaped($raw);
@@ -670,8 +668,8 @@ protected function assertEscaped($raw) {
   * @param string $raw
   *   Raw (HTML) string to look for.
   *
   * Deprecated Scheduled for removal in Drupal 10.0.0.
   *   Use $this->assertSession()->assertNoEscaped() instead.
   * Deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use
   *   $this->assertSession()->assertNoEscaped() instead.
   */
  protected function assertNoEscaped($raw) {
    $this->assertSession()->assertNoEscaped($raw);
@@ -683,8 +681,8 @@ protected function assertNoEscaped($raw) {
   * @param string $pattern
   *   Perl regex to look for including the regex delimiters.
   *
   * Deprecated Scheduled for removal in Drupal 10.0.0.
   *   Use $this->assertSession()->responseMatches() instead.
   * Deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use
  *   $this->assertSession()->responseMatches() instead.
   */
  protected function assertPattern($pattern) {
    $this->assertSession()->responseMatches($pattern);
@@ -696,13 +694,13 @@ protected function assertPattern($pattern) {
   * @param string $pattern
   *   Perl regex to look for including the regex delimiters.
   *
   * Deprecated Scheduled for removal in Drupal 10.0.0.
   *   Use $this->assertSession()->responseNotMatches() instead.
   * Deprecated in drupal:8.4.0 and is removed from drupal:10.0.0. Use
   *   $this->assertSession()->responseNotMatches() instead.
   *
   * @see https://www.drupal.org/node/2864262
   */
  protected function assertNoPattern($pattern) {
    @trigger_error('assertNoPattern() is deprecated and scheduled for removal in Drupal 9.0.0. Use $this->assertSession()->responseNotMatches($pattern) instead. See https://www.drupal.org/node/2864262.', E_USER_DEPRECATED);
    @trigger_error('AssertLegacyTrait::assertNoPattern() is deprecated in drupal:8.4.0 and is removed from drupal:10.0.0. Use $this->assertSession()->responseNotMatches() instead. See https://www.drupal.org/node/2864262', E_USER_DEPRECATED);
    $this->assertSession()->responseNotMatches($pattern);
  }

@@ -712,8 +710,8 @@ protected function assertNoPattern($pattern) {
   * @param string $expected_cache_tag
   *   The expected cache tag.
   *
   * Deprecated Scheduled for removal in Drupal 10.0.0.
   *   Use $this->assertSession()->responseHeaderContains() instead.
   * Deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use
   *   $this->assertSession()->responseHeaderContains() instead.
   */
  protected function assertCacheTag($expected_cache_tag) {
    $this->assertSession()->responseHeaderContains('X-Drupal-Cache-Tags', $expected_cache_tag);
@@ -725,13 +723,13 @@ protected function assertCacheTag($expected_cache_tag) {
   * @param string $cache_tag
   *   The cache tag to check.
   *
   * Deprecated Scheduled for removal in Drupal 10.0.0.
   *   Use $this->assertSession()->responseHeaderNotContains() instead.
   * Deprecated in drupal:8.4.0 and is removed from drupal:10.0.0. Use
   *   $this->assertSession()->responseHeaderNotContains() instead.
   *
   * @see https://www.drupal.org/node/2864029
   */
  protected function assertNoCacheTag($cache_tag) {
    @trigger_error('assertNoCacheTag() is deprecated and scheduled for removal in Drupal 9.0.0. Use $this->assertSession()->responseHeaderNotContains() instead. See https://www.drupal.org/node/2864029.', E_USER_DEPRECATED);
    @trigger_error('AssertLegacyTrait::assertNoCacheTag() is deprecated in drupal:8.4.0 and is removed from drupal:10.0.0. Use $this->assertSession()->responseHeaderNotContains() instead. See https://www.drupal.org/node/2864029', E_USER_DEPRECATED);
    $this->assertSession()->responseHeaderNotContains('X-Drupal-Cache-Tags', $cache_tag);
  }

@@ -743,8 +741,8 @@ protected function assertNoCacheTag($cache_tag) {
   * @param string $value
   *   Value of the header to assert
   *
   * Deprecated Scheduled for removal in Drupal 10.0.0.
   *   Use $this->assertSession()->responseHeaderEquals() instead.
   * Deprecated in drupal:8.3.0 and is removed from drupal:10.0.0. Use
   *   $this->assertSession()->responseHeaderEquals() instead.
   */
  protected function assertHeader($name, $value) {
    $this->assertSession()->responseHeaderEquals($name, $value);
@@ -781,8 +779,8 @@ abstract public function assertSession($name = NULL);
   * @return string
   *   An XPath query with arguments replaced.
   *
   * Deprecated Scheduled for removal in Drupal 10.0.0.
   *   Use $this->assertSession()->buildXPathQuery() instead.
   * Deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use
   *   $this->assertSession()->buildXPathQuery() instead.
   */
  protected function buildXPathQuery($xpath, array $args = []) {
    return $this->assertSession()->buildXPathQuery($xpath, $args);
@@ -799,8 +797,8 @@ protected function buildXPathQuery($xpath, array $args = []) {
   * @return string
   *   XPath for specified values.
   *
   * Deprecated Scheduled for removal in Drupal 10.0.0.
   *   Use $this->getSession()->getPage()->findField() instead.
   * Deprecated in drupal:8.5.0 and is removed from drupal:10.0.0. Use
   *   $this->getSession()->getPage()->findField() instead.
   */
  protected function constructFieldXpath($attribute, $value) {
    $xpath = '//textarea[@' . $attribute . '=:value]|//input[@' . $attribute . '=:value]|//select[@' . $attribute . '=:value]';
@@ -810,11 +808,13 @@ protected function constructFieldXpath($attribute, $value) {
  /**
   * Gets the current raw content.
   *
   * Deprecated Scheduled for removal in Drupal 10.0.0.
   *   Use $this->getSession()->getPage()->getContent() instead.
   * Deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use
   *   $this->getSession()->getPage()->getContent() instead.
   *
   * @see http://drupal.org/node/2735045
   */
  protected function getRawContent() {
    @trigger_error('AssertLegacyTrait::getRawContent() is scheduled for removal in Drupal 9.0.0. Use $this->getSession()->getPage()->getContent() instead.', E_USER_DEPRECATED);
    @trigger_error('AssertLegacyTrait::getRawContent() is deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->getSession()->getPage()->getContent() instead. See http://drupal.org/node/2735045', E_USER_DEPRECATED);
    return $this->getSession()->getPage()->getContent();
  }

@@ -827,11 +827,13 @@ protected function getRawContent() {
   * @return \Behat\Mink\Element\NodeElement[]
   *   Option elements in select.
   *
   * Deprecated Scheduled for removal in Drupal 10.0.0.
   *   Use $element->findAll('xpath', 'option') instead.
   * Deprecated in drupal:8.5.0 and is removed from drupal:10.0.0. Use
   *   $element->findAll('xpath', 'option') instead.
   *
   * @see http://drupal.org/node/2735045
   */
  protected function getAllOptions(NodeElement $element) {
    @trigger_error('AssertLegacyTrait::getAllOptions() is scheduled for removal in Drupal 9.0.0. Use $element->findAll(\'xpath\', \'option\') instead.', E_USER_DEPRECATED);
    @trigger_error('AssertLegacyTrait::getAllOptions() is deprecated in drupal:8.5.0 and is removed from drupal:10.0.0. Use $element->findAll(\'xpath\', \'option\') instead. See http://drupal.org/node/2735045', E_USER_DEPRECATED);
    return $element->findAll('xpath', '//option');
  }

+10 −2
Original line number Diff line number Diff line
@@ -242,9 +242,17 @@ public function testTextAsserts() {
    $sanitized = Html::escape($dangerous);
    $this->assertNoText($dangerous);
    $this->assertText($sanitized);
  }

    // Test getRawContent().
    $this->assertSame($this->getSession()->getPage()->getContent(), $this->getSession()->getPage()->getContent());
  /**
   * Tests legacy getRawContent().
   *
   * @group legacy
   * @expectedDeprecation AssertLegacyTrait::getRawContent() is deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->getSession()->getPage()->getContent() instead. See http://drupal.org/node/2735045
   */
  public function testGetRawContent() {
    $this->drupalGet('test-encoded');
    $this->assertSame($this->getSession()->getPage()->getContent(), $this->getRawContent());
  }

  /**
+1 −1
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ class AssertLegacyTraitDeprecatedTest extends BrowserTestBase {
  /**
   * Tests getAllOptions().
   *
   * @expectedDeprecation AssertLegacyTrait::getAllOptions() is scheduled for removal in Drupal 9.0.0. Use $element->findAll('xpath', 'option') instead.
   * @expectedDeprecation AssertLegacyTrait::getAllOptions() is deprecated in drupal:8.5.0 and is removed from drupal:10.0.0. Use $element->findAll('xpath', 'option') instead. See http://drupal.org/node/2735045
   */
  public function testGetAllOptions() {
    $this->drupalGet('/form-test/select');
+2 −2
Original line number Diff line number Diff line
@@ -156,7 +156,7 @@ public function testAssertOptionSelectedFail() {

  /**
   * @covers ::assertNoPattern
   * @expectedDeprecation assertNoPattern() is deprecated and scheduled for removal in Drupal 9.0.0. Use $this->assertSession()->responseNotMatches($pattern) instead. See https://www.drupal.org/node/2864262.
   * @expectedDeprecation AssertLegacyTrait::assertNoPattern() is deprecated in drupal:8.4.0 and is removed from drupal:10.0.0. Use $this->assertSession()->responseNotMatches() instead. See https://www.drupal.org/node/2864262
   */
  public function testAssertNoPattern() {
    $this->webAssert
@@ -168,7 +168,7 @@ public function testAssertNoPattern() {

  /**
   * @covers ::assertNoCacheTag
   * @expectedDeprecation assertNoCacheTag() is deprecated and scheduled for removal in Drupal 9.0.0. Use $this->assertSession()->responseHeaderNotContains() instead. See https://www.drupal.org/node/2864029.
   * @expectedDeprecation AssertLegacyTrait::assertNoCacheTag() is deprecated in drupal:8.4.0 and is removed from drupal:10.0.0. Use $this->assertSession()->responseHeaderNotContains() instead. See https://www.drupal.org/node/2864029
   */
  public function testAssertNoCacheTag() {
    $this->webAssert