function AssertLegacyTrait::assertNoFieldById
Same name in other branches
- 8.9.x core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php \Drupal\FunctionalTests\AssertLegacyTrait::assertNoFieldById()
Asserts that a field does not exist with the given ID and value.
Parameters
string $id: ID of field to assert.
string $value: (optional) Value for the field, to assert that the field's value on the page doesn't match it. You may pass in NULL to skip checking the value, while still checking that the field doesn't exist. However, the default value ('') asserts that the field value is not an empty string.
Throws
\Behat\Mink\Exception\ExpectationException
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.
See also
https://www.drupal.org/node/3129738
1 call to AssertLegacyTrait::assertNoFieldById()
- BrowserTestBaseTest::testAssertFieldById in core/
tests/ Drupal/ FunctionalTests/ BrowserTestBaseTest.php - Tests legacy field asserts by id and by Xpath.
File
-
core/
tests/ Drupal/ FunctionalTests/ AssertLegacyTrait.php, line 520
Class
- AssertLegacyTrait
- Provides convenience methods for assertions in browser tests.
Namespace
Drupal\FunctionalTestsCode
protected function assertNoFieldById($id, $value = '') {
@trigger_error('AssertLegacyTrait::assertNoFieldById() is 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. See https://www.drupal.org/node/3129738', E_USER_DEPRECATED);
$xpath = $this->assertSession()
->buildXPathQuery('//textarea[@id=:value]|//input[@id=:value]|//select[@id=:value]', [
':value' => $id,
]);
$this->assertNoFieldByXPath($xpath, $value);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.