Tests link field widgets and formatters.
Expanded class hierarchy of LinkFieldTest
class LinkFieldTest extends WebTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array(
'field_test',
'link',
);
public static function getInfo() {
return array(
'name' => 'Link field',
'description' => 'Tests link field widgets and formatters.',
'group' => 'Field types',
);
}
function setUp() {
parent::setUp();
$this->web_user = $this
->drupalCreateUser(array(
'access field_test content',
'administer field_test content',
));
$this
->drupalLogin($this->web_user);
}
/**
* Tests link field URL validation.
*/
function testURLValidation() {
// Create a field with settings to validate.
$this->field = array(
'field_name' => drupal_strtolower($this
->randomName()),
'type' => 'link',
);
field_create_field($this->field);
$this->instance = array(
'field_name' => $this->field['field_name'],
'entity_type' => 'test_entity',
'bundle' => 'test_bundle',
'settings' => array(
'title' => DRUPAL_DISABLED,
),
'widget' => array(
'type' => 'link_default',
'settings' => array(
'placeholder_url' => 'http://example.com',
),
),
'display' => array(
'full' => array(
'type' => 'link',
),
),
);
field_create_instance($this->instance);
$langcode = LANGUAGE_NOT_SPECIFIED;
// Display creation form.
$this
->drupalGet('test-entity/add/test_bundle');
$this
->assertFieldByName("{$this->field['field_name']}[{$langcode}][0][url]", '', 'Link URL field is displayed');
$this
->assertRaw('placeholder="http://example.com"');
// Verify that a valid URL can be submitted.
$value = 'http://www.example.com/';
$edit = array(
"{$this->field['field_name']}[{$langcode}][0][url]" => $value,
);
$this
->drupalPost(NULL, $edit, t('Save'));
preg_match('|test-entity/manage/(\\d+)/edit|', $this->url, $match);
$id = $match[1];
$this
->assertRaw(t('test_entity @id has been created.', array(
'@id' => $id,
)));
$this
->assertRaw($value);
// Verify that invalid URLs cannot be submitted.
$wrong_entries = array(
// Missing protcol
'not-an-url',
// Invalid protocol
'invalid://not-a-valid-protocol',
// Missing host name
'http://',
);
$this
->drupalGet('test-entity/add/test_bundle');
foreach ($wrong_entries as $invalid_value) {
$edit = array(
"{$this->field['field_name']}[{$langcode}][0][url]" => $invalid_value,
);
$this
->drupalPost(NULL, $edit, t('Save'));
$this
->assertText(t('The URL @url is not valid.', array(
'@url' => $invalid_value,
)));
}
}
/**
* Tests the title settings of a link field.
*/
function testLinkTitle() {
// Create a field with settings to validate.
$this->field = array(
'field_name' => drupal_strtolower($this
->randomName()),
'type' => 'link',
);
field_create_field($this->field);
$this->instance = array(
'field_name' => $this->field['field_name'],
'entity_type' => 'test_entity',
'bundle' => 'test_bundle',
'settings' => array(
'title' => DRUPAL_OPTIONAL,
),
'widget' => array(
'type' => 'link_default',
'settings' => array(
'placeholder_url' => 'http://example.com',
'placeholder_title' => 'Enter a title for this link',
),
),
'display' => array(
'full' => array(
'type' => 'link',
'label' => 'hidden',
),
),
);
field_create_instance($this->instance);
$langcode = LANGUAGE_NOT_SPECIFIED;
// Verify that the title field works according to the field setting.
foreach (array(
DRUPAL_DISABLED,
DRUPAL_REQUIRED,
DRUPAL_OPTIONAL,
) as $title_setting) {
// Update the title field setting.
$this->instance['settings']['title'] = $title_setting;
field_update_instance($this->instance);
// Display creation form.
$this
->drupalGet('test-entity/add/test_bundle');
$this
->assertFieldByName("{$this->field['field_name']}[{$langcode}][0][url]", '', 'URL field found.');
$this
->assertRaw('placeholder="http://example.com"');
if ($title_setting === DRUPAL_DISABLED) {
$this
->assertNoFieldByName("{$this->field['field_name']}[{$langcode}][0][title]", '', 'Title field not found.');
$this
->assertNoRaw('placeholder="Enter a title for this link"');
}
else {
$this
->assertRaw('placeholder="Enter a title for this link"');
$this
->assertFieldByName("{$this->field['field_name']}[{$langcode}][0][title]", '', 'Title field found.');
if ($title_setting === DRUPAL_REQUIRED) {
// Verify that the title is required, if the URL is non-empty.
$edit = array(
"{$this->field['field_name']}[{$langcode}][0][url]" => 'http://www.example.com',
);
$this
->drupalPost(NULL, $edit, t('Save'));
$this
->assertText(t('!name field is required.', array(
'!name' => t('Title'),
)));
// Verify that the title is not required, if the URL is empty.
$edit = array(
"{$this->field['field_name']}[{$langcode}][0][url]" => '',
);
$this
->drupalPost(NULL, $edit, t('Save'));
$this
->assertNoText(t('!name field is required.', array(
'!name' => t('Title'),
)));
// Verify that a URL and title meets requirements.
$this
->drupalGet('test-entity/add/test_bundle');
$edit = array(
"{$this->field['field_name']}[{$langcode}][0][url]" => 'http://www.example.com',
"{$this->field['field_name']}[{$langcode}][0][title]" => 'Example',
);
$this
->drupalPost(NULL, $edit, t('Save'));
$this
->assertNoText(t('!name field is required.', array(
'!name' => t('Title'),
)));
}
}
}
// Verify that a link without title is rendered using the URL as link text.
$value = 'http://www.example.com/';
$edit = array(
"{$this->field['field_name']}[{$langcode}][0][url]" => $value,
"{$this->field['field_name']}[{$langcode}][0][title]" => '',
);
$this
->drupalPost(NULL, $edit, t('Save'));
preg_match('|test-entity/manage/(\\d+)/edit|', $this->url, $match);
$id = $match[1];
$this
->assertRaw(t('test_entity @id has been created.', array(
'@id' => $id,
)));
$this
->renderTestEntity($id);
$expected_link = l($value, $value);
$this
->assertRaw($expected_link);
// Verify that a link with title is rendered using the title as link text.
$title = $this
->randomName();
$edit = array(
"{$this->field['field_name']}[{$langcode}][0][title]" => $title,
);
$this
->drupalPost("test-entity/manage/{$id}/edit", $edit, t('Save'));
$this
->assertRaw(t('test_entity @id has been updated.', array(
'@id' => $id,
)));
$this
->renderTestEntity($id);
$expected_link = l($title, $value);
$this
->assertRaw($expected_link);
}
/**
* Tests the default 'link' formatter.
*/
function testLinkFormatter() {
// Create a field with settings to validate.
$this->field = array(
'field_name' => drupal_strtolower($this
->randomName()),
'type' => 'link',
'cardinality' => 2,
);
field_create_field($this->field);
$this->instance = array(
'field_name' => $this->field['field_name'],
'entity_type' => 'test_entity',
'bundle' => 'test_bundle',
'settings' => array(
'title' => DRUPAL_OPTIONAL,
),
'widget' => array(
'type' => 'link_default',
),
'display' => array(
'full' => array(
'type' => 'link',
'label' => 'hidden',
),
),
);
field_create_instance($this->instance);
$langcode = LANGUAGE_NOT_SPECIFIED;
// Create an entity with two link field values:
// - The first field item uses a URL only.
// - The second field item uses a URL and title.
// For consistency in assertion code below, the URL is assigned to the title
// variable for the first field.
$this
->drupalGet('test-entity/add/test_bundle');
$url1 = 'http://www.example.com/content/articles/archive?author=John&year=2012#com';
$url2 = 'http://www.example.org/content/articles/archive?author=John&year=2012#org';
$title1 = $url1;
// Intentionally contains an ampersand that needs sanitization on output.
$title2 = 'A very long & strange example title that could break the nice layout of the site';
$edit = array(
"{$this->field['field_name']}[{$langcode}][0][url]" => $url1,
// Note that $title1 is not submitted.
"{$this->field['field_name']}[{$langcode}][0][title]" => '',
"{$this->field['field_name']}[{$langcode}][1][url]" => $url2,
"{$this->field['field_name']}[{$langcode}][1][title]" => $title2,
);
$this
->drupalPost(NULL, $edit, t('Save'));
preg_match('|test-entity/manage/(\\d+)/edit|', $this->url, $match);
$id = $match[1];
$this
->assertRaw(t('test_entity @id has been created.', array(
'@id' => $id,
)));
// Verify that the link is output according to the formatter settings.
// Not using generatePermutations(), since that leads to 32 cases, which
// would not test actual link field formatter functionality but rather
// theme_link() and options/attributes. Only 'url_plain' has a dependency on
// 'url_only', so we have a total of ~10 cases.
$options = array(
'trim_length' => array(
NULL,
6,
),
'rel' => array(
NULL,
'nofollow',
),
'target' => array(
NULL,
'_blank',
),
'url_only' => array(
array(
'url_only' => array(
FALSE,
),
),
array(
'url_only' => array(
FALSE,
),
'url_plain' => TRUE,
),
array(
'url_only' => array(
TRUE,
),
),
array(
'url_only' => array(
TRUE,
),
'url_plain' => TRUE,
),
),
);
foreach ($options as $setting => $values) {
foreach ($values as $new_value) {
// Update the field formatter settings.
if (!is_array($new_value)) {
$this->instance['display']['full']['settings'] = array(
$setting => $new_value,
);
}
else {
$this->instance['display']['full']['settings'] = $new_value;
}
field_update_instance($this->instance);
$this
->renderTestEntity($id);
switch ($setting) {
case 'trim_length':
$url = $url1;
$title = isset($new_value) ? truncate_utf8($title1, $new_value, FALSE, TRUE) : $title1;
$this
->assertRaw('<a href="' . check_plain($url) . '">' . check_plain($title) . '</a>');
$url = $url2;
$title = isset($new_value) ? truncate_utf8($title2, $new_value, FALSE, TRUE) : $title2;
$this
->assertRaw('<a href="' . check_plain($url) . '">' . check_plain($title) . '</a>');
break;
case 'rel':
$rel = isset($new_value) ? ' rel="' . $new_value . '"' : '';
$this
->assertRaw('<a href="' . check_plain($url1) . '"' . $rel . '>' . check_plain($title1) . '</a>');
$this
->assertRaw('<a href="' . check_plain($url2) . '"' . $rel . '>' . check_plain($title2) . '</a>');
break;
case 'target':
$target = isset($new_value) ? ' target="' . $new_value . '"' : '';
$this
->assertRaw('<a href="' . check_plain($url1) . '"' . $target . '>' . check_plain($title1) . '</a>');
$this
->assertRaw('<a href="' . check_plain($url2) . '"' . $target . '>' . check_plain($title2) . '</a>');
break;
case 'url_only':
// In this case, $new_value is an array.
if (!$new_value['url_only']) {
$this
->assertRaw('<a href="' . check_plain($url1) . '">' . check_plain($title1) . '</a>');
$this
->assertRaw('<a href="' . check_plain($url2) . '">' . check_plain($title2) . '</a>');
}
else {
if (empty($new_value['url_plain'])) {
$this
->assertRaw('<a href="' . check_plain($url1) . '">' . check_plain($url1) . '</a>');
$this
->assertRaw('<a href="' . check_plain($url2) . '">' . check_plain($url2) . '</a>');
}
else {
$this
->assertNoRaw('<a href="' . check_plain($url1) . '">' . check_plain($url1) . '</a>');
$this
->assertNoRaw('<a href="' . check_plain($url2) . '">' . check_plain($url2) . '</a>');
$this
->assertRaw(check_plain($url1));
$this
->assertRaw(check_plain($url2));
}
}
break;
}
}
}
}
/**
* Tests the 'link_separate' formatter.
*
* This test is mostly the same as testLinkFormatter(), but they cannot be
* merged, since they involve different configuration and output.
*/
function testLinkSeparateFormatter() {
// Create a field with settings to validate.
$this->field = array(
'field_name' => drupal_strtolower($this
->randomName()),
'type' => 'link',
'cardinality' => 2,
);
field_create_field($this->field);
$this->instance = array(
'field_name' => $this->field['field_name'],
'entity_type' => 'test_entity',
'bundle' => 'test_bundle',
'settings' => array(
'title' => DRUPAL_OPTIONAL,
),
'widget' => array(
'type' => 'link_default',
),
'display' => array(
'full' => array(
'type' => 'link_separate',
'label' => 'hidden',
),
),
);
field_create_instance($this->instance);
$langcode = LANGUAGE_NOT_SPECIFIED;
// Create an entity with two link field values:
// - The first field item uses a URL only.
// - The second field item uses a URL and title.
// For consistency in assertion code below, the URL is assigned to the title
// variable for the first field.
$this
->drupalGet('test-entity/add/test_bundle');
$url1 = 'http://www.example.com/content/articles/archive?author=John&year=2012#com';
$url2 = 'http://www.example.org/content/articles/archive?author=John&year=2012#org';
// Intentionally contains an ampersand that needs sanitization on output.
$title2 = 'A very long & strange example title that could break the nice layout of the site';
$edit = array(
"{$this->field['field_name']}[{$langcode}][0][url]" => $url1,
"{$this->field['field_name']}[{$langcode}][1][url]" => $url2,
"{$this->field['field_name']}[{$langcode}][1][title]" => $title2,
);
$this
->drupalPost(NULL, $edit, t('Save'));
preg_match('|test-entity/manage/(\\d+)/edit|', $this->url, $match);
$id = $match[1];
$this
->assertRaw(t('test_entity @id has been created.', array(
'@id' => $id,
)));
// Verify that the link is output according to the formatter settings.
$options = array(
'trim_length' => array(
NULL,
6,
),
'rel' => array(
NULL,
'nofollow',
),
'target' => array(
NULL,
'_blank',
),
);
foreach ($options as $setting => $values) {
foreach ($values as $new_value) {
// Update the field formatter settings.
$this->instance['display']['full']['settings'] = array(
$setting => $new_value,
);
field_update_instance($this->instance);
$this
->renderTestEntity($id);
switch ($setting) {
case 'trim_length':
$url = $url1;
$url_title = isset($new_value) ? truncate_utf8($url, $new_value, FALSE, TRUE) : $url;
$expected = '<div class="link-item">';
$expected .= '<div class="link-url"><a href="' . check_plain($url) . '">' . check_plain($url_title) . '</a></div>';
$expected .= '</div>';
$this
->assertRaw($expected);
$url = $url2;
$url_title = isset($new_value) ? truncate_utf8($url, $new_value, FALSE, TRUE) : $url;
$title = isset($new_value) ? truncate_utf8($title2, $new_value, FALSE, TRUE) : $title2;
$expected = '<div class="link-item">';
$expected .= '<div class="link-title">' . check_plain($title) . '</div>';
$expected .= '<div class="link-url"><a href="' . check_plain($url) . '">' . check_plain($url_title) . '</a></div>';
$expected .= '</div>';
$this
->assertRaw($expected);
break;
case 'rel':
$rel = isset($new_value) ? ' rel="' . $new_value . '"' : '';
$this
->assertRaw('<div class="link-url"><a href="' . check_plain($url1) . '"' . $rel . '>' . check_plain($url1) . '</a></div>');
$this
->assertRaw('<div class="link-url"><a href="' . check_plain($url2) . '"' . $rel . '>' . check_plain($url2) . '</a></div>');
break;
case 'target':
$target = isset($new_value) ? ' target="' . $new_value . '"' : '';
$this
->assertRaw('<div class="link-url"><a href="' . check_plain($url1) . '"' . $target . '>' . check_plain($url1) . '</a></div>');
$this
->assertRaw('<div class="link-url"><a href="' . check_plain($url2) . '"' . $target . '>' . check_plain($url2) . '</a></div>');
break;
}
}
}
}
/**
* Renders a test_entity and sets the output in the internal browser.
*
* @param int $id
* The test_entity ID to render.
* @param string $view_mode
* (optional) The view mode to use for rendering.
* @param bool $reset
* (optional) Whether to reset the test_entity controller cache. Defaults to
* TRUE to simplify testing.
*/
protected function renderTestEntity($id, $view_mode = 'full', $reset = TRUE) {
if ($reset) {
entity_get_controller('test_entity')
->resetCache(array(
$id,
));
}
$entity = field_test_entity_test_load($id);
field_attach_prepare_view('test_entity', array(
$entity
->id() => $entity,
), $view_mode);
$entity->content = field_attach_view('test_entity', $entity, $view_mode);
$output = drupal_render($entity->content);
$this
->drupalSetContent($output);
$this
->verbose($output);
}
}
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
LinkFieldTest:: |
public static | property | Modules to enable. | |
LinkFieldTest:: |
public static | function | ||
LinkFieldTest:: |
protected | function | Renders a test_entity and sets the output in the internal browser. | |
LinkFieldTest:: |
function |
Sets up a Drupal site for running functional and integration tests. Overrides WebTestBase:: |
||
LinkFieldTest:: |
function | Tests the default 'link' formatter. | ||
LinkFieldTest:: |
function | Tests the 'link_separate' formatter. | ||
LinkFieldTest:: |
function | Tests the title settings of a link field. | ||
LinkFieldTest:: |
function | Tests link field URL validation. | ||
TestBase:: |
protected | property | Assertions thrown in that test case. | |
TestBase:: |
protected | property | The database prefix of this test run. | |
TestBase:: |
protected | property | The original file directory, before it was changed for testing purposes. | |
TestBase:: |
protected | property | The original database prefix when running inside Simpletest. | |
TestBase:: |
public | property | Current results of this test case. | |
TestBase:: |
protected | property | Flag to indicate whether the test has been set up. | |
TestBase:: |
protected | property | ||
TestBase:: |
protected | property | ||
TestBase:: |
protected | property | This class is skipped when looking for the source of an assertion. | |
TestBase:: |
protected | property | The test run ID. | |
TestBase:: |
protected | property | Time limit for the test. | |
TestBase:: |
protected | property | TRUE if verbose debugging is enabled. | |
TestBase:: |
protected | property | Safe class name for use in verbose output filenames. | |
TestBase:: |
protected | property | Directory where verbose output files are put. | |
TestBase:: |
protected | property | URL to the verbose output file directory. | |
TestBase:: |
protected | property | Incrementing identifier for verbose output filenames. | |
TestBase:: |
protected | function | Internal helper: stores the assert. | |
TestBase:: |
protected | function | Check to see if two values are equal. | |
TestBase:: |
protected | function | Check to see if a value is false (an empty string, 0, NULL, or FALSE). | |
TestBase:: |
protected | function | Check to see if two values are identical. | |
TestBase:: |
protected | function | Checks to see if two objects are identical. | |
TestBase:: |
protected | function | Check to see if two values are not equal. | |
TestBase:: |
protected | function | Check to see if two values are not identical. | |
TestBase:: |
protected | function | Check to see if a value is not NULL. | |
TestBase:: |
protected | function | Check to see if a value is NULL. | |
TestBase:: |
protected | function | Check to see if a value is not false (not an empty string, 0, NULL, or FALSE). | |
TestBase:: |
protected | function | Changes the database connection to the prefixed one. | |
TestBase:: |
protected | function | Checks the matching requirements for Test. | 3 |
TestBase:: |
public static | function | Delete an assertion record by message ID. | |
TestBase:: |
protected | function | Fire an error assertion. | 1 |
TestBase:: |
public | function | Handle errors during test runs. | |
TestBase:: |
protected | function | Handle exceptions. | |
TestBase:: |
protected | function | Fire an assertion that is always negative. | |
TestBase:: |
public static | function | Ensures test files are deletable within file_unmanaged_delete_recursive(). | |
TestBase:: |
public static | function | Converts a list of possible parameters into a stack of permutations. | |
TestBase:: |
protected | function | Cycles through backtrace until the first non-assertion method is found. | |
TestBase:: |
public static | function | Returns the database connection to the site running Simpletest. | |
TestBase:: |
public static | function | Store an assertion from outside the testing context. | |
TestBase:: |
protected | function | Fire an assertion that is always positive. | |
TestBase:: |
protected | function | Generates a database prefix for running tests. | |
TestBase:: |
protected | function | Prepares the current environment for running the test. | |
TestBase:: |
public static | function | Generates a random string containing letters and numbers. | |
TestBase:: |
public static | function | Generates a random PHP object. | |
TestBase:: |
public static | function | Generates a random string of ASCII characters of codes 32 to 126. | |
TestBase:: |
protected | function | Rebuild drupal_container(). | |
TestBase:: |
public | function | Run all tests in this class. | |
TestBase:: |
protected | function | Logs verbose message in a text file. | |
WebTestBase:: |
protected | property | Additional cURL options. | |
WebTestBase:: |
protected | property | The content of the page currently loaded in the internal browser. | |
WebTestBase:: |
protected | property | The current cookie file used by cURL. | |
WebTestBase:: |
protected | property | The handle of the current cURL connection. | |
WebTestBase:: |
protected | property | The value of the Drupal.settings JavaScript variable for the page currently loaded in the internal browser. | |
WebTestBase:: |
protected | property | The parsed version of the page. | 1 |
WebTestBase:: |
protected | property | Whether the files were copied to the test files directory. | |
WebTestBase:: |
protected | property | The headers of the page currently loaded in the internal browser. | |
WebTestBase:: |
protected | property | HTTP authentication credentials (<username>:<password>). | |
WebTestBase:: |
protected | property | HTTP authentication method | |
WebTestBase:: |
protected | property | The kernel used in this test. | |
WebTestBase:: |
protected | property | The current user logged in using the internal browser. | |
WebTestBase:: |
protected | property | The maximum number of redirects to follow when handling responses. | |
WebTestBase:: |
protected | property | The original shutdown handlers array, before it was cleaned for testing purposes. | |
WebTestBase:: |
protected | property | The original user, before it was changed to a clean uid = 1 for testing purposes. | |
WebTestBase:: |
protected | property | The content of the page currently loaded in the internal browser (plain text version). | |
WebTestBase:: |
protected | property | The profile to install as a basis for testing. | 35 |
WebTestBase:: |
protected | property | The number of redirects followed during the handling of a request. | |
WebTestBase:: |
protected | property | The current session ID, if available. | |
WebTestBase:: |
protected | property | The current session name, if available. | |
WebTestBase:: |
protected | property | The URL currently loaded in the internal browser. | |
WebTestBase:: |
protected | function | Asserts that a field exists with the given name or id. | |
WebTestBase:: |
protected | function | Asserts that a field exists in the current page with the given id and value. | |
WebTestBase:: |
protected | function | Asserts that a field exists in the current page with the given name and value. | |
WebTestBase:: |
protected | function | Asserts that a field exists in the current page by the given XPath. | |
WebTestBase:: |
protected | function | Asserts that a checkbox field in the current page is checked. | |
WebTestBase:: |
protected | function | Pass if a link with the specified label is found, and optional with the specified index. | |
WebTestBase:: |
protected | function | Pass if a link containing a given href (part) is found. | |
WebTestBase:: |
protected | function | Asserts that the most recently sent e-mail message has the given value. | |
WebTestBase:: |
protected | function | Asserts that the most recently sent e-mail message has the pattern in it. | |
WebTestBase:: |
protected | function | Asserts that the most recently sent e-mail message has the string in it. | |
WebTestBase:: |
protected | function | Asserts that each HTML ID is used for just a single element. | |
WebTestBase:: |
protected | function | Asserts that a field does not exist with the given name or id. | |
WebTestBase:: |
protected | function | Asserts that a field does not exist with the given id and value. | |
WebTestBase:: |
protected | function | Asserts that a field does not exist with the given name and value. | |
WebTestBase:: |
protected | function | Asserts that a field does not exist in the current page by the given XPath. | |
WebTestBase:: |
protected | function | Asserts that a checkbox field in the current page is not checked. | |
WebTestBase:: |
protected | function | Pass if a link with the specified label is not found. | |
WebTestBase:: |
protected | function | Pass if a link containing a given href (part) is not found. | |
WebTestBase:: |
protected | function | Asserts that a select option in the current page does not exist. | |
WebTestBase:: |
protected | function | Asserts that a select option in the current page is not checked. | |
WebTestBase:: |
protected | function | Will trigger a pass if the perl regex pattern is not present in raw content. | |
WebTestBase:: |
protected | function | Pass if the raw text is NOT found on the loaded page, fail otherwise. Raw text refers to the raw HTML that the page generated. | |
WebTestBase:: |
protected | function | Asserts the page did not return the specified response code. | |
WebTestBase:: |
protected | function | Pass if the text is NOT found on the text version of the page. The text version is the equivalent of what a user would see when viewing through a web browser. In other words the HTML has been filtered out of the contents. | |
WebTestBase:: |
protected | function | Pass if the page title is not the given string. | |
WebTestBase:: |
protected | function | Pass if the text is found MORE THAN ONCE on the text version of the page. | |
WebTestBase:: |
protected | function | Asserts that a select option in the current page exists. | |
WebTestBase:: |
protected | function | Asserts that a select option in the current page is checked. | |
WebTestBase:: |
protected | function | Will trigger a pass if the Perl regex pattern is found in the raw content. | |
WebTestBase:: |
protected | function | Pass if the raw text IS found on the loaded page, fail otherwise. Raw text refers to the raw HTML that the page generated. | |
WebTestBase:: |
protected | function | Asserts the page responds with the specified response code. | |
WebTestBase:: |
protected | function | Pass if the text IS found on the text version of the page. The text version is the equivalent of what a user would see when viewing through a web browser. In other words the HTML has been filtered out of the contents. | |
WebTestBase:: |
protected | function | Helper for assertText and assertNoText. | |
WebTestBase:: |
protected | function | Asserts themed output. | |
WebTestBase:: |
protected | function | Pass if the page title is the given string. | |
WebTestBase:: |
protected | function | Pass if the text is found ONLY ONCE on the text version of the page. | |
WebTestBase:: |
protected | function | Helper for assertUniqueText and assertNoUniqueText. | |
WebTestBase:: |
protected | function | Pass if the internal browser's URL matches the given path. | |
WebTestBase:: |
protected | function | Builds an XPath query. | |
WebTestBase:: |
protected | function | Check for meta refresh tag and if found call drupalGet() recursively. This function looks for the http-equiv attribute to be set to "Refresh" and is case-sensitive. | |
WebTestBase:: |
protected | function | Check to make sure that the array of permissions are valid. | |
WebTestBase:: |
protected | function | Follows a link by name. | |
WebTestBase:: |
protected | function | Helper function: construct an XPath for the given set of attributes and value. | |
WebTestBase:: |
protected | function | Creates a typed data object and executes some basic assertions. | |
WebTestBase:: |
protected | function | Runs cron in the Drupal installed by Simpletest. | |
WebTestBase:: |
protected | function | Close the cURL handler and unset the handler. | |
WebTestBase:: |
protected | function | Initializes and executes a cURL request. | |
WebTestBase:: |
protected | function | Reads headers and registers errors received from the tested site. | |
WebTestBase:: |
protected | function | Initializes the cURL connection. | |
WebTestBase:: |
protected | function | Compare two files based on size and file name. | |
WebTestBase:: |
protected | function | Creates a custom content type based on default settings. | |
WebTestBase:: |
protected | function | Creates a node based on default settings. | |
WebTestBase:: |
protected | function | Internal helper function; Create a role with specified permissions. | |
WebTestBase:: |
protected | function | Create a user with a given set of permissions. | |
WebTestBase:: |
protected | function | Retrieves a Drupal path or an absolute path. | |
WebTestBase:: |
protected | function | Retrieve a Drupal path or an absolute path and JSON decode the result. | |
WebTestBase:: |
protected | function | Gets the current raw HTML of requested page. | |
WebTestBase:: |
protected | function | Gets the value of an HTTP response header. If multiple requests were required to retrieve the page, only the headers from the last request will be checked by default. However, if TRUE is passed as the second argument, all requests will be processed… | |
WebTestBase:: |
protected | function | Gets the HTTP response headers of the requested page. Normally we are only interested in the headers returned by the last request. However, if a page is redirected or HTTP authentication is in use, multiple requests will be required to retrieve the… | |
WebTestBase:: |
protected | function | Gets an array containing all e-mails sent during this test case. | |
WebTestBase:: |
function | Get a node from the database based on its title. | ||
WebTestBase:: |
protected | function | Gets the value of the Drupal.settings JavaScript variable for the currently loaded page. | |
WebTestBase:: |
protected | function | Get a list files that can be used in tests. | |
WebTestBase:: |
protected | function | Generate a token for the currently logged in user. | |
WebTestBase:: |
protected | function | Retrieves only the headers for a Drupal path or an absolute path. | |
WebTestBase:: |
protected | function | Log in a user with the internal browser. | |
WebTestBase:: |
protected | function | ||
WebTestBase:: |
protected | function | Execute a POST request on a Drupal page. It will be done as usual POST request with SimpleBrowser. | |
WebTestBase:: |
protected | function | Execute an Ajax submission. | |
WebTestBase:: |
protected | function | Sets the raw HTML content. This can be useful when a page has been fetched outside of the internal browser and assertions need to be made on the returned page. | |
WebTestBase:: |
protected | function | Sets the value of the Drupal.settings JavaScript variable for the currently loaded page. | |
WebTestBase:: |
protected | function | Takes a path and returns an absolute path. | |
WebTestBase:: |
protected | function | Get all option elements, including nested options, in a select. | |
WebTestBase:: |
protected | function | Get the selected value from a select field. | |
WebTestBase:: |
protected | function | Get the current URL from the cURL handler. | |
WebTestBase:: |
protected | function | Handle form input related to drupalPost(). Ensure that the specified fields exist and attempt to create POST data in the correct manner for the particular field type. | |
WebTestBase:: |
protected | function | Parse content returned from curlExec using DOM and SimpleXML. | |
WebTestBase:: |
protected | function | Refresh the in-memory set of variables. Useful after a page request is made that changes a variable in a different thread. | 1 |
WebTestBase:: |
protected | function | Reset all data structures after having enabled new modules. | |
WebTestBase:: |
protected | function |
Delete created files and temporary files directory, delete the tables created by setUp(),
and reset the database prefix. Overrides TestBase:: |
6 |
WebTestBase:: |
protected | function | Outputs to verbose the most recent $count emails sent. | |
WebTestBase:: |
protected | function | Perform an xpath search on the contents of the internal browser. The search is relative to the root element (HTML tag normally) of the page. | |
WebTestBase:: |
function |
Constructor for Drupal\simpletest\WebTestBase. Overrides TestBase:: |