diff -u b/core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php b/core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php --- b/core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php +++ b/core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php @@ -191,6 +191,28 @@ $this->pass('The "name" field was found.'); } + $this->assertFieldById('edit-name',NULL); + $this->assertFieldById('edit-name', 'Test name'); + $this->assertFieldById('edit-description'); + + // Test that the assertion fails correctly if no value is passed in. + try { + $this->assertFieldById('edit-name'); + $this->fail('The "edit-name" field with no value was found.'); + } + catch (ExpectationException $e) { + $this->pass('The "edit-name" field with no value was not found.'); + } + + // Test that the assertion fails correctly if NULL is passed in. + try { + $this->assertFieldById('name', NULL); + $this->fail('The "name" field was found.'); + } + catch (ExpectationException $e) { + $this->pass('The "name" field was not found.'); + } + $this->assertNoFieldByName('name'); $this->assertNoFieldByName('name', 'not the value'); $this->assertNoFieldByName('notexisting');