protected function DrupalWebTestCase::assertFieldByName

7.x drupal_web_test_case.php protected DrupalWebTestCase::assertFieldByName($name, $value = NULL, $message = NULL)

Asserts that a field exists in the current page with the given name and value.

Parameters

$name: Name of field to assert.

$value: Value of the field to assert.

$message: Message to display.

$group: The group this message belongs to.

Return value

TRUE on pass, FALSE on fail.

47 calls to DrupalWebTestCase::assertFieldByName()
AggregatorConfigurationTestCase::testSettingsPage in drupal-7.x/modules/aggregator/aggregator.test
Tests the settings form to ensure the correct default values are used.
AggregatorRenderingTestCase::testBlockLinks in drupal-7.x/modules/aggregator/aggregator.test
Adds a feed block to the page and checks its links.
CommentAnonymous::testAnonymous in drupal-7.x/modules/comment/comment.test
Test anonymous comment functionality.
CommentHelperCase::postComment in drupal-7.x/modules/comment/comment.test
Post comment.
CommentPreviewTest::testCommentEditPreviewSave in drupal-7.x/modules/comment/comment.test
Test comment edit, preview, and save.

... See full list

File

drupal-7.x/modules/simpletest/drupal_web_test_case.php, line 3327

Class

DrupalWebTestCase
Test case for typical Drupal tests.

Code

protected function assertFieldByName($name, $value = NULL, $message = NULL) {
  if (!isset($message)) {
    if (!isset($value)) {
      $message = t('Found field with name @name', array(
        '@name' => var_export($name, TRUE),
      ));
    }
    else {
      $message = t('Found field with name @name and value @value', array(
        '@name' => var_export($name, TRUE),
        '@value' => var_export($value, TRUE),
      ));
    }
  }
  return $this->assertFieldByXPath($this->constructFieldXpath('name', $name), $value, $message, t('Browser'));
}