function BrowserTestBaseTest::testLegacyFieldAssertsByName

Tests legacy assertFieldByName() and assertNoFieldByName().

@group legacy

File

core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php, line 944

Class

BrowserTestBaseTest
Tests BrowserTestBase functionality.

Namespace

Drupal\FunctionalTests

Code

public function testLegacyFieldAssertsByName() {
    $this->expectDeprecation('AssertLegacyTrait::assertFieldByName() is 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. See https://www.drupal.org/node/3129738');
    $this->expectDeprecation('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');
    $this->drupalGet('test-field-xpath');
    $this->assertFieldByName('checkbox_enabled', TRUE);
    $this->assertNoFieldByName('checkbox_enabled', FALSE);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.