Issue #3139403 by mondrake: Replace usages of AssertLegacyTrait::assertElement(Not)Present, that is deprecated

merge-requests/2419/head
xjm 2020-05-26 13:27:13 -05:00
parent 4e62462808
commit f73194d078
3 changed files with 25 additions and 3 deletions

View File

@ -75,7 +75,7 @@ class PagerTest extends BrowserTestBase {
// Verify the pager does not render on a list without pagination.
$this->drupalGet('admin/config/media/image-styles');
$this->assertElementNotPresent('.pager');
$this->assertSession()->elementNotExists('css', '.pager');
}
/**

View File

@ -178,6 +178,30 @@ class AssertLegacyTraitTest extends UnitTestCase {
$this->assertNoCacheTag('some-cache-tag');
}
/**
* @covers ::assertElementPresent
* @expectedDeprecation AssertLegacyTrait::assertElementPresent() is deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->elementExists() instead. See https://www.drupal.org/node/3129738
*/
public function testAssertElementPresent() {
$this->webAssert
->elementExists('css', '.pager')
->shouldBeCalled();
$this->assertElementPresent('.pager');
}
/**
* @covers ::assertElementNotPresent
* @expectedDeprecation AssertLegacyTrait::assertElementNotPresent() is deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->elementNotExists() instead. See https://www.drupal.org/node/3129738
*/
public function testAssertElementNotPresent() {
$this->webAssert
->elementNotExists('css', '.pager')
->shouldBeCalled();
$this->assertElementNotPresent('.pager');
}
/**
* Returns a mocked behat session object.
*

View File

@ -173,8 +173,6 @@ trait DeprecationListenerTrait {
'AssertLegacyTrait::assertIdentical() is deprecated in drupal:8.0.0 and is removed from drupal:10.0.0. Use $this->assertSame() instead. See https://www.drupal.org/node/3129738',
'AssertLegacyTrait::assertNotIdentical() is deprecated in drupal:8.0.0 and is removed from drupal:10.0.0. Use $this->assertNotSame() instead. See https://www.drupal.org/node/3129738',
'AssertLegacyTrait::pass() is deprecated in drupal:8.0.0 and is removed from drupal:10.0.0. PHPUnit interrupts a test as soon as a test assertion fails, so there is usually no need to call this method. If a test\'s logic relies on this method, refactor the test. See https://www.drupal.org/node/3129738',
'AssertLegacyTrait::assertElementPresent() is deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->elementExists() instead. See https://www.drupal.org/node/3129738',
'AssertLegacyTrait::assertElementNotPresent() is deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->elementNotExists() instead. See https://www.drupal.org/node/3129738',
'AssertLegacyTrait::assertText() is deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->responseContains() or $this->assertSession()->pageTextContains() instead. See https://www.drupal.org/node/3129738',
'AssertLegacyTrait::assertNoText() is deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->responseNotContains() or $this->assertSession()->pageTextNotContains() instead. See https://www.drupal.org/node/3129738',
'AssertLegacyTrait::assertText() is deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->pageTextContains() or $this->assertSession()->pageTextNotContains() instead. See https://www.drupal.org/node/3129738',