protected function AssertLegacyTrait::assertNoFieldByName in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php \Drupal\FunctionalTests\AssertLegacyTrait::assertNoFieldByName()
Asserts that a field does not exist with the given name and value.
Parameters
string $name: Name of field to assert.
string $value: (optional) Value for the field, to assert that the field's value on the page does not match it. You may pass in NULL to skip checking the 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
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::assertNoFieldByName()
- BrowserTestBaseTest::testLegacyFieldAssertsByName in core/
tests/ Drupal/ FunctionalTests/ BrowserTestBaseTest.php - Tests legacy assertFieldByName() and assertNoFieldByName().
File
- core/
tests/ Drupal/ FunctionalTests/ AssertLegacyTrait.php, line 299
Class
- AssertLegacyTrait
- Provides convenience methods for assertions in browser tests.
Namespace
Drupal\FunctionalTestsCode
protected function assertNoFieldByName($name, $value = '') {
@trigger_error('AssertLegacyTrait::assertNoFieldByName() 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[@name=:value]|//input[@name=:value]|//select[@name=:value]', [
':value' => $name,
]);
$this
->assertNoFieldByXPath($xpath, $value);
}