You are here

protected function AssertLegacyTrait::assertNoField in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php \Drupal\FunctionalTests\AssertLegacyTrait::assertNoField()

Asserts that a field does NOT exist with the given name or ID.

Parameters

string $field: Name or ID of field to assert.

Deprecated

in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->fieldNotExists() or $this->assertSession()->buttonNotExists() instead.

See also

https://www.drupal.org/node/3129738

1 call to AssertLegacyTrait::assertNoField()
BrowserTestBaseTest::testAssertField in core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php
Tests legacy field asserts using textfields.

File

core/tests/Drupal/FunctionalTests/AssertLegacyTrait.php, line 363

Class

AssertLegacyTrait
Provides convenience methods for assertions in browser tests.

Namespace

Drupal\FunctionalTests

Code

protected function assertNoField($field) {
  @trigger_error('AssertLegacyTrait::assertNoField() is deprecated in drupal:8.2.0 and is removed from drupal:10.0.0. Use $this->assertSession()->fieldNotExists() or $this->assertSession()->buttonNotExists() 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' => $field,
  ]) . '|' . $this
    ->assertSession()
    ->buildXPathQuery('//textarea[@id=:value]|//input[@id=:value]|//select[@id=:value]', [
    ':value' => $field,
  ]);
  $this
    ->assertNoFieldByXPath($xpath);
}