class TMGMTI18nStringSourceTestCase in Translation Management Tool 7
Basic i18n String Source tests.
Hierarchy
- class \DrupalTestCase
- class \DrupalWebTestCase
- class \TMGMTBaseTestCase
- class \DrupalWebTestCase
Expanded class hierarchy of TMGMTI18nStringSourceTestCase
File
- sources/
i18n_string/ tmgmt_i18n_string.test, line 6
View source
class TMGMTI18nStringSourceTestCase extends TMGMTBaseTestCase {
static function getInfo() {
return array(
'name' => 'i18n String Source tests',
'description' => 'Exporting source data from i18n string and saving translations back',
'group' => 'Translation Management',
'dependencies' => array(
'i18n_string',
),
);
}
function setUp() {
parent::setUp(array(
'tmgmt_ui',
'tmgmt_i18n_string',
'taxonomy',
'i18n_taxonomy',
'i18n_block',
'i18n_field',
'list',
'i18n_menu',
));
$this
->setEnvironment('de');
$this->translator = $this
->createTranslator();
}
function testI18nStringSourceTaxonomy() {
// Test translation of a vocabulary.
/////////////////////////////////////
$config = array(
'name' => $this
->randomName(),
'machine_name' => 'test_vocab',
'i18n_mode' => I18N_MODE_LOCALIZE,
);
$vocabulary = entity_create('taxonomy_vocabulary', $config);
taxonomy_vocabulary_save($vocabulary);
$string_object_name = "taxonomy:vocabulary:" . $vocabulary->vid;
$source_text = $vocabulary->name;
// Create the new job and job item.
$job = $this
->createJob();
$job->translator = $this->translator->name;
$job->settings = array();
$job
->save();
$item1 = $job
->addItem('i18n_string', 'taxonomy_vocabulary', $string_object_name);
$this
->assertEqual(t('Vocabulary'), $item1
->getSourceType());
$job
->requestTranslation();
foreach ($job
->getItems() as $item) {
/* @var $item TMGMTJobItem */
$item
->acceptTranslation();
}
// Check the structure of the imported data.
$this
->assertEqual($item1->item_id, $string_object_name, 'i18n Strings object correctly saved');
// Check string translation.
$this
->assertEqual(i18n_string_translate('taxonomy:vocabulary:' . $vocabulary->vid . ':name', $source_text, array(
'langcode' => $job->target_language,
)), $job->target_language . '_' . $source_text);
// Test translation of a taxonomy term.
/////////////////////////////////////
$term = entity_create('taxonomy_term', array(
'vid' => $vocabulary->vid,
'name' => $this
->randomName(),
'description' => $this
->randomName(),
));
taxonomy_term_save($term);
$string_object_name = "taxonomy:term:" . $term->tid;
$source_text_name = $term->name;
$source_text_description = $term->description;
// Create the new job and job item.
$job = $this
->createJob();
$job->translator = $this->translator->name;
$job->settings = array();
$job
->save();
$item1 = $job
->addItem('i18n_string', 'taxonomy_term', $string_object_name);
$this
->assertEqual(t('Taxonomy term'), $item1
->getSourceType());
$job
->requestTranslation();
/* @var $item TMGMTJobItem */
foreach ($job
->getItems() as $item) {
// The source is available only in en.
$this
->assertJobItemLangCodes($item, 'en', array(
'en',
));
$item
->acceptTranslation();
// The source should be now available in de and en.
$this
->assertJobItemLangCodes($item, 'en', array(
'de',
'en',
));
}
// Check the structure of the imported data.
$this
->assertEqual($item1->item_id, $string_object_name);
// Check string translation.
$this
->assertEqual(i18n_string_translate('taxonomy:term:' . $term->tid . ':name', $source_text_name, array(
'langcode' => $job->target_language,
)), $job->target_language . '_' . $source_text_name);
$this
->assertEqual(i18n_string_translate('taxonomy:term:' . $term->tid . ':description', $source_text_description, array(
'langcode' => $job->target_language,
)), $job->target_language . '_' . $source_text_description);
}
/**
* Test if the source is able to pull content in requested language.
*/
function testRequestDataForSpecificLanguage() {
$this
->setEnvironment('es');
$this
->setEnvironment('cs');
$config = array(
'name' => $this
->randomName(),
'machine_name' => 'test_vocab',
'i18n_mode' => I18N_MODE_LOCALIZE,
);
$vocabulary = entity_create('taxonomy_vocabulary', $config);
taxonomy_vocabulary_save($vocabulary);
$string_object_name = "taxonomy:vocabulary:" . $vocabulary->vid;
i18n_string_translation_update($string_object_name . ':name', 'de translation', 'de');
// Create new job item with a source language for which the translation
// exits.
$job = $this
->createJob('de', 'cs');
$job
->save();
$job
->addItem('i18n_string', 'taxonomy_vocabulary', $string_object_name);
$data = $job
->getData();
$this
->assertEqual($data[1][$string_object_name . ':name']['#text'], 'de translation');
// Create new job item with a source language for which the translation
// does not exit.
$job = $this
->createJob('es', 'cs');
$job
->save();
try {
$job
->addItem('i18n_string', 'taxonomy_vocabulary', $string_object_name);
$this
->fail('The job item should not be added as there is no translation for language "es"');
} catch (TMGMTException $e) {
$languages = language_list();
$this
->assertEqual(t('Unable to load %language translation for the string %title', array(
'%language' => $languages['es']->name,
'%title' => 'Name',
)), $e
->getMessage());
}
}
function testI18nStringSourceMenu() {
drupal_static_reset('_tmgmt_plugin_info');
drupal_static_reset('_tmgmt_plugin_controller');
// Test translation of a menu.
/////////////////////////////////////
$config = array(
'menu_name' => $this
->randomName(),
'title' => $this
->randomName(),
'description' => $this
->randomName(),
'i18n_mode' => I18N_MODE_MULTIPLE,
);
menu_save($config);
$menu = menu_load($config['menu_name']);
$source_text = $menu['title'];
$string_name = 'menu:menu:' . $menu['menu_name'];
// Create the new job and job item.
$job = $this
->createJob();
$job->translator = $this->translator->name;
$job->settings = array();
$item1 = $job
->addItem('i18n_string', 'menu', $string_name);
$this
->assertEqual(t('Menu'), $item1
->getSourceType());
$job
->requestTranslation();
/* @var $item TMGMTJobItem */
foreach ($job
->getItems() as $item) {
$this
->assertJobItemLangCodes($item, 'en', array(
'en',
));
$item
->acceptTranslation();
$this
->assertJobItemLangCodes($item, 'en', array(
'de',
'en',
));
}
$data = $item1
->getData();
$this
->assertEqual($data['menu:menu:' . $menu['menu_name'] . ':title']['#text'], $config['title']);
$this
->assertEqual($data['menu:menu:' . $menu['menu_name'] . ':description']['#text'], $config['description']);
// Check the structure of the imported data.
$this
->assertEqual($item1->item_id, $string_name, 'String is correctly saved');
// Check string translation.
$this
->assertEqual(i18n_string_translate($string_name . ':title', $source_text, array(
'langcode' => $job->target_language,
)), $job->target_language . '_' . $source_text);
// Test translation of a menu item.
/////////////////////////////////////
$source_text = $this
->randomName();
$menu_link = array(
'link_path' => '<front>',
'link_title' => $source_text,
// i18n_menu_link::get_title() uses the title, set that too.
'title' => $source_text,
'menu_name' => $menu['menu_name'],
'customized' => TRUE,
);
menu_link_save($menu_link);
$string_name = 'menu:item:' . $menu_link['mlid'];
// Create the new job and job item.
$job = $this
->createJob();
$job->translator = $this->translator->name;
$job->settings = array();
$item1 = $job
->addItem('i18n_string', 'menu_link', $string_name);
$this
->assertEqual(t('Menu link'), $item1
->getSourceType());
$job
->requestTranslation();
/* @var $item TMGMTJobItem */
foreach ($job
->getItems() as $item) {
$this
->assertJobItemLangCodes($item, 'en', array(
'en',
));
$item
->acceptTranslation();
$this
->assertJobItemLangCodes($item, 'en', array(
'de',
'en',
));
}
$data = $item1
->getData();
$this
->assertEqual($data[$string_name . ':title']['#text'], $source_text);
// Check the structure of the imported data.
$this
->assertEqual($item1->item_id, $string_name);
// Check string translation.
$this
->assertEqual(i18n_string_translate($string_name . ':title', $source_text, array(
'langcode' => $job->target_language,
)), $job->target_language . '_' . $source_text);
}
function testI18nStringSourceLangCodes() {
$config = array(
'name' => $this
->randomName(),
'description' => 'description_' . $this
->randomName(),
'machine_name' => 'test_vocab',
'i18n_mode' => I18N_MODE_LOCALIZE,
);
$vocabulary = entity_create('taxonomy_vocabulary', $config);
taxonomy_vocabulary_save($vocabulary);
$string_object_name = "taxonomy:vocabulary:" . $vocabulary->vid;
// Create the new job and job item.
$job = $this
->createJob();
$job->translator = $this->translator->name;
$job->settings = array();
$job
->save();
$item = $job
->addItem('i18n_string', 'taxonomy_vocabulary', $string_object_name);
$this
->assertJobItemLangCodes($item, 'en', array(
'en',
));
i18n_string_translation_update($string_object_name . ':description', 'de_' . $config['description'], 'de');
$this
->assertJobItemLangCodes($item, 'en', array(
'en',
));
i18n_string_translation_update($string_object_name . ':name', 'de_' . $config['name'], 'de');
$this
->assertJobItemLangCodes($item, 'en', array(
'en',
'de',
));
}
function testI18nStringPluginUI() {
$this
->loginAsAdmin(array(
'administer taxonomy',
'translate interface',
'translate user-defined strings',
));
$vocab_data = array(
'name' => $this
->randomName(),
'machine_name' => 'test_vocab',
'i18n_mode' => I18N_MODE_LOCALIZE,
);
$term_data = array(
'name' => $this
->randomName(),
);
$vocab_data_not_translated = array(
'name' => $this
->randomName(),
'machine_name' => 'test_vocab3',
'i18n_mode' => I18N_MODE_LOCALIZE,
);
// Configure taxonomy and create vocab + term.
$this
->drupalPost('admin/structure/taxonomy/add', $vocab_data, t('Save'));
$this
->drupalGet('admin/structure/taxonomy');
$this
->clickLink(t('add terms'));
$this
->drupalPost(NULL, $term_data, t('Save'));
$this
->drupalPost('admin/structure/taxonomy/add', $vocab_data_not_translated, t('Save'));
$this
->drupalGet('admin/tmgmt/sources/i18n_string_taxonomy_vocabulary');
$this
->assertText($vocab_data['name']);
// Request translation via i18n source tab
$this
->drupalPost(NULL, array(
'items[taxonomy:vocabulary:1]' => 1,
), t('Request translation'));
// Test for the job checkout url.
$this
->assertTrue(strpos($this
->getUrl(), 'admin/tmgmt/jobs') !== FALSE);
entity_get_controller('tmgmt_job')
->resetCache();
$jobs = entity_load('tmgmt_job', FALSE);
/** @var TMGMTJob $job */
$job = array_pop($jobs);
$this
->assertFieldByName('label', $job
->label());
// Request translation via translate tab of i18n.
$this
->drupalPost('admin/structure/taxonomy/test_vocab/translate', array(
'languages[taxonomy:vocabulary:1:de]' => 1,
), t('Request translation'));
$this
->drupalPost(NULL, array(), t('Submit to translator'));
// Verify that the job item status is shown.
$this
->assertText(t('Needs review'));
$this
->clickLink(t('review'));
$this
->drupalPost(NULL, array(), t('Save as completed'));
$this
->assertText(t('The translation for @label has been accepted.', array(
'@label' => $job
->label(),
)));
// Test the missing translation filter.
$this
->drupalGet('admin/tmgmt/sources/i18n_string_taxonomy_vocabulary');
// Check that the source language has been removed from the target language
// select box.
$elements = $this
->xpath('//select[@name=:name]//option[@value=:option]', array(
':name' => 'search[target_language]',
':option' => i18n_string_source_language(),
));
$this
->assertTrue(empty($elements));
$edit = array(
'search[target_language]' => 'de',
'search[target_status]' => 'untranslated',
);
$this
->drupalPost('admin/tmgmt/sources/i18n_string_taxonomy_vocabulary', $edit, t('Search'));
// The vocabulary name is translated to "de" therefore it must not show up
// in the list.
$this
->assertNoText($vocab_data['name']);
$this
->assertText($vocab_data_not_translated['name']);
$edit = array(
'search[target_language]' => 'de',
'search[target_status]' => 'untranslated',
);
$this
->drupalPost(NULL, $edit, t('Search'));
$this
->assertNoText($vocab_data['name']);
$this
->assertText($vocab_data_not_translated['name']);
// Update the string status to I18N_STRING_STATUS_UPDATE.
$lid = db_select('locales_source', 's')
->fields('s', array(
'lid',
))
->condition('source', $vocab_data['name'])
->execute()
->fetchField();
db_update('locales_target')
->fields(array(
'i18n_status' => I18N_STRING_STATUS_UPDATE,
))
->condition('lid', $lid)
->execute();
$edit = array(
'search[target_language]' => 'de',
'search[target_status]' => 'outdated',
);
$this
->drupalPost(NULL, $edit, t('Search'));
$this
->assertText($vocab_data['name']);
$this
->assertNoText($vocab_data_not_translated['name']);
$edit = array(
'search[target_language]' => 'de',
'search[target_status]' => 'untranslated_or_outdated',
);
$this
->drupalPost(NULL, $edit, t('Search'));
$this
->assertText($vocab_data['name']);
$this
->assertText($vocab_data_not_translated['name']);
}
/**
* Tests translation of blocks through the user interface.
*/
function testI18nStringPluginUIBlock() {
$this
->loginAsAdmin(array(
'administer blocks',
'translate interface',
'translate user-defined strings',
));
// Make some blocks translatable.
$navigation_edit = array(
'title' => $this
->randomName(),
'i18n_mode' => 1,
);
$this
->drupalPost('admin/structure/block/manage/system/navigation/configure', $navigation_edit, t('Save block'));
$powered_edit = array(
'title' => $this
->randomName(),
'i18n_mode' => 1,
);
$this
->drupalPost('admin/structure/block/manage/system/powered-by/configure', $powered_edit, t('Save block'));
$this
->drupalGet('admin/tmgmt/sources/i18n_string_block');
$this
->assertText($navigation_edit['title']);
$this
->assertText($powered_edit['title']);
// Request translation via i18n source tab.
$edit = array(
'items[blocks:system:powered-by]' => 1,
'items[blocks:system:navigation]' => 1,
);
$this
->drupalPost(NULL, $edit, t('Request translation'));
$this
->assertText($navigation_edit['title']);
$this
->assertText($powered_edit['title']);
$this
->drupalPost(NULL, array(), t('Submit to translator'));
$this
->assertRaw(t('Active job item: Needs review'));
}
/**
* Tests translation of fields through the user interface.
*/
function testI18nStringPluginUIField() {
$this
->loginAsAdmin(array(
'translate interface',
'translate user-defined strings',
));
$type = $this
->drupalCreateContentType(array(
'type' => $type = $this
->randomName(),
));
// Create a field.
$field = array(
'field_name' => 'list_test',
'type' => 'list_text',
);
for ($i = 0; $i < 5; $i++) {
$field['settings']['allowed_values'][$this
->randomName()] = $this
->randomString();
}
field_create_field($field);
// Create an instance of the previously created field.
$instance = array(
'field_name' => 'list_test',
'entity_type' => 'node',
'bundle' => $type->type,
'label' => $this
->randomName(10),
'description' => $this
->randomString(30),
);
field_create_instance($instance);
// The body field doesn't have anything that can be translated on the field
// level, so it shouldn't show up in the field overview.
$this
->drupalGet('admin/tmgmt/sources/i18n_string_field');
$this
->assertNoText(t('Body'));
// @todo: Label doesn't work here?
$this
->assertText('field:list_test:#allowed_values');
$this
->drupalGet('admin/tmgmt/sources/i18n_string_field_instance');
$this
->assertUniqueText(t('Body'));
$this
->assertUniqueText($instance['label']);
// Request translation.
$edit = array(
'items[field:body:' . $type->type . ']' => 1,
'items[field:list_test:' . $type->type . ']' => 1,
);
$this
->drupalPost(NULL, $edit, t('Request translation'));
$this
->assertText(t('Body'));
$this
->assertText($instance['label']);
$this
->drupalPost(NULL, array(), t('Submit to translator'));
$this
->assertRaw(t('Active job item: Needs review'));
// Review the first item.
$this
->clickLink(t('reviewed'));
$this
->drupalPost(NULL, array(), t('Save as completed'));
// The overview should now have a translated field and a pending job item.
$this
->drupalGet('admin/tmgmt/sources/i18n_string_field_instance');
$this
->assertRaw(t('Translation up to date'));
$this
->assertRaw(t('Active job item: Needs review'));
}
/**
* Test the i18n specific cart functionality.
*/
function testCart() {
$vocabulary1 = entity_create('taxonomy_vocabulary', array(
'name' => $this
->randomName(),
'description' => 'description_' . $this
->randomName(),
'machine_name' => 'test_vocab1',
'i18n_mode' => I18N_MODE_LOCALIZE,
));
taxonomy_vocabulary_save($vocabulary1);
$string1 = "taxonomy:vocabulary:" . $vocabulary1->vid;
$vocabulary2 = entity_create('taxonomy_vocabulary', array(
'name' => $this
->randomName(),
'description' => 'description_' . $this
->randomName(),
'machine_name' => 'test_vocab2',
'i18n_mode' => I18N_MODE_LOCALIZE,
));
taxonomy_vocabulary_save($vocabulary2);
$string2 = "taxonomy:vocabulary:" . $vocabulary2->vid;
$vocabulary3 = entity_create('taxonomy_vocabulary', array(
'name' => $this
->randomName(),
'description' => 'description_' . $this
->randomName(),
'machine_name' => 'test_vocab3',
'i18n_mode' => I18N_MODE_LOCALIZE,
));
taxonomy_vocabulary_save($vocabulary3);
$this
->loginAsAdmin(array_merge($this->translator_permissions, array(
'translate interface',
'translate user-defined strings',
)));
// Test source overview.
$this
->drupalPost('admin/tmgmt/sources/i18n_string_taxonomy_vocabulary', array(
'items[' . $string1 . ']' => TRUE,
'items[' . $string2 . ']' => TRUE,
), t('Add to cart'));
$this
->drupalGet('admin/tmgmt/cart');
$this
->assertText($vocabulary1->name);
$this
->assertText($vocabulary2->name);
// Test translate tab.
$this
->drupalGet('admin/structure/taxonomy/test_vocab3/translate');
$this
->assertRaw(t('There are @count items in the <a href="@url">translation cart</a>.', array(
'@count' => 2,
'@url' => url('admin/tmgmt/cart'),
)));
$this
->drupalPost(NULL, array(), t('Add to cart'));
$this
->assertRaw(t('@count content source was added into the <a href="@url">cart</a>.', array(
'@count' => 1,
'@url' => url('admin/tmgmt/cart'),
)));
$this
->assertRaw(t('There are @count items in the <a href="@url">translation cart</a> including the current item.', array(
'@count' => 3,
'@url' => url('admin/tmgmt/cart'),
)));
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DrupalTestCase:: |
protected | property | Assertions thrown in that test case. | |
DrupalTestCase:: |
protected | property | The database prefix of this test run. | |
DrupalTestCase:: |
protected | property | The original file directory, before it was changed for testing purposes. | |
DrupalTestCase:: |
public | property | Current results of this test case. | |
DrupalTestCase:: |
protected | property | Flag to indicate whether the test has been set up. | |
DrupalTestCase:: |
protected | property | ||
DrupalTestCase:: |
protected | property | ||
DrupalTestCase:: |
protected | property | This class is skipped when looking for the source of an assertion. | |
DrupalTestCase:: |
protected | property | The test run ID. | |
DrupalTestCase:: |
protected | property | Time limit for the test. | |
DrupalTestCase:: |
public | property | Whether to cache the installation part of the setUp() method. | |
DrupalTestCase:: |
public | property | Whether to cache the modules installation part of the setUp() method. | |
DrupalTestCase:: |
protected | property | URL to the verbose output file directory. | |
DrupalTestCase:: |
protected | function | Internal helper: stores the assert. | |
DrupalTestCase:: |
protected | function | Check to see if two values are equal. | |
DrupalTestCase:: |
protected | function | Check to see if a value is false (an empty string, 0, NULL, or FALSE). | |
DrupalTestCase:: |
protected | function | Check to see if two values are identical. | |
DrupalTestCase:: |
protected | function | Check to see if two values are not equal. | |
DrupalTestCase:: |
protected | function | Check to see if two values are not identical. | |
DrupalTestCase:: |
protected | function | Check to see if a value is not NULL. | |
DrupalTestCase:: |
protected | function | Check to see if a value is NULL. | |
DrupalTestCase:: |
protected | function | Check to see if a value is not false (not an empty string, 0, NULL, or FALSE). | |
DrupalTestCase:: |
public static | function | Delete an assertion record by message ID. | |
DrupalTestCase:: |
protected | function | Fire an error assertion. | 1 |
DrupalTestCase:: |
public | function | Handle errors during test runs. | 1 |
DrupalTestCase:: |
protected | function | Handle exceptions. | |
DrupalTestCase:: |
protected | function | Fire an assertion that is always negative. | |
DrupalTestCase:: |
public static | function | Converts a list of possible parameters into a stack of permutations. | |
DrupalTestCase:: |
protected | function | Cycles through backtrace until the first non-assertion method is found. | |
DrupalTestCase:: |
public static | function | Returns the database connection to the site running Simpletest. | |
DrupalTestCase:: |
public static | function | Store an assertion from outside the testing context. | |
DrupalTestCase:: |
protected | function | Fire an assertion that is always positive. | |
DrupalTestCase:: |
public static | function | Generates a random string containing letters and numbers. | |
DrupalTestCase:: |
public static | function | Generates a random string of ASCII characters of codes 32 to 126. | |
DrupalTestCase:: |
public | function | Run all tests in this class. | |
DrupalTestCase:: |
protected | function | Logs a verbose message in a text file. | |
DrupalWebTestCase:: |
protected | property | Additional cURL options. | |
DrupalWebTestCase:: |
protected | property | The content of the page currently loaded in the internal browser. | |
DrupalWebTestCase:: |
protected | property | The current cookie file used by cURL. | |
DrupalWebTestCase:: |
protected | property | The cookies of the page currently loaded in the internal browser. | |
DrupalWebTestCase:: |
protected | property | The handle of the current cURL connection. | |
DrupalWebTestCase:: |
protected | property | The value of the Drupal.settings JavaScript variable for the page currently loaded in the internal browser. | |
DrupalWebTestCase:: |
protected | property | The parsed version of the page. | |
DrupalWebTestCase:: |
protected | property | Whether the files were copied to the test files directory. | |
DrupalWebTestCase:: |
protected | property | The headers of the page currently loaded in the internal browser. | |
DrupalWebTestCase:: |
protected | property | HTTP authentication credentials (<username>:<password>). | |
DrupalWebTestCase:: |
protected | property | HTTP authentication method | |
DrupalWebTestCase:: |
protected | property | The current user logged in using the internal browser. | |
DrupalWebTestCase:: |
protected | property | The original shutdown handlers array, before it was cleaned for testing purposes. | |
DrupalWebTestCase:: |
protected | property | The original user, before it was changed to a clean uid = 1 for testing purposes. | |
DrupalWebTestCase:: |
protected | property | The content of the page currently loaded in the internal browser (plain text version). | |
DrupalWebTestCase:: |
protected | property | The number of redirects followed during the handling of a request. | |
DrupalWebTestCase:: |
protected | property | The current session ID, if available. | |
DrupalWebTestCase:: |
protected | property | The current session name, if available. | |
DrupalWebTestCase:: |
protected | property | The URL currently loaded in the internal browser. | |
DrupalWebTestCase:: |
protected | function | Asserts that a field exists with the given name or ID. | |
DrupalWebTestCase:: |
protected | function | Asserts that a field exists in the current page with the given ID and value. | |
DrupalWebTestCase:: |
protected | function | Asserts that a field exists in the current page with the given name and value. | |
DrupalWebTestCase:: |
protected | function | Asserts that a field exists in the current page by the given XPath. | |
DrupalWebTestCase:: |
protected | function | Asserts that a checkbox field in the current page is checked. | |
DrupalWebTestCase:: |
protected | function | Pass if a link with the specified label is found, and optional with the specified index. | |
DrupalWebTestCase:: |
protected | function | Pass if a link containing a given href (part) is found. | |
DrupalWebTestCase:: |
protected | function | Asserts that the most recently sent e-mail message has the given value. | |
DrupalWebTestCase:: |
protected | function | Asserts that the most recently sent e-mail message has the pattern in it. | |
DrupalWebTestCase:: |
protected | function | Asserts that the most recently sent e-mail message has the string in it. | |
DrupalWebTestCase:: |
protected | function | Asserts that each HTML ID is used for just a single element. | |
DrupalWebTestCase:: |
protected | function | Asserts that a field does not exist with the given name or ID. | |
DrupalWebTestCase:: |
protected | function | Asserts that a field does not exist with the given ID and value. | |
DrupalWebTestCase:: |
protected | function | Asserts that a field does not exist with the given name and value. | |
DrupalWebTestCase:: |
protected | function | Asserts that a field doesn't exist or its value doesn't match, by XPath. | |
DrupalWebTestCase:: |
protected | function | Asserts that a checkbox field in the current page is not checked. | |
DrupalWebTestCase:: |
protected | function | Pass if a link with the specified label is not found. | |
DrupalWebTestCase:: |
protected | function | Pass if a link containing a given href (part) is not found. | |
DrupalWebTestCase:: |
protected | function | Asserts that a select option in the current page is not checked. | |
DrupalWebTestCase:: |
protected | function | Will trigger a pass if the perl regex pattern is not present in raw content. | |
DrupalWebTestCase:: |
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. | |
DrupalWebTestCase:: |
protected | function | Asserts the page did not return the specified response code. | |
DrupalWebTestCase:: |
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. | |
DrupalWebTestCase:: |
protected | function | Pass if the page title is not the given string. | |
DrupalWebTestCase:: |
protected | function | Pass if the text is found MORE THAN ONCE on the text version of the page. | |
DrupalWebTestCase:: |
protected | function | Asserts that a select option in the current page is checked. | |
DrupalWebTestCase:: |
protected | function | Will trigger a pass if the Perl regex pattern is found in the raw content. | |
DrupalWebTestCase:: |
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. | |
DrupalWebTestCase:: |
protected | function | Asserts the page responds with the specified response code. | |
DrupalWebTestCase:: |
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. | |
DrupalWebTestCase:: |
protected | function | Helper for assertText and assertNoText. | |
DrupalWebTestCase:: |
protected | function | Asserts themed output. | |
DrupalWebTestCase:: |
protected | function | Pass if the page title is the given string. | |
DrupalWebTestCase:: |
protected | function | Pass if the text is found ONLY ONCE on the text version of the page. | |
DrupalWebTestCase:: |
protected | function | Helper for assertUniqueText and assertNoUniqueText. | |
DrupalWebTestCase:: |
protected | function | Pass if the internal browser's URL matches the given path. | |
DrupalWebTestCase:: |
protected | function | Builds an XPath query. | |
DrupalWebTestCase:: |
protected | function | Changes the database connection to the prefixed one. | |
DrupalWebTestCase:: |
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. | |
DrupalWebTestCase:: |
protected | function | Check to make sure that the array of permissions are valid. | |
DrupalWebTestCase:: |
protected | function | Follows a link by name. | |
DrupalWebTestCase:: |
protected | function | Helper function: construct an XPath for the given set of attributes and value. | |
DrupalWebTestCase:: |
protected | function | Copy the setup cache from/to another table and files directory. | |
DrupalWebTestCase:: |
protected | function | Runs cron in the Drupal installed by Simpletest. | |
DrupalWebTestCase:: |
protected | function | Close the cURL handler and unset the handler. | |
DrupalWebTestCase:: |
protected | function | Initializes and executes a cURL request. | |
DrupalWebTestCase:: |
protected | function | Reads headers and registers errors received from the tested site. | |
DrupalWebTestCase:: |
protected | function | Initializes the cURL connection. | |
DrupalWebTestCase:: |
protected | function | Compare two files based on size and file name. | |
DrupalWebTestCase:: |
protected | function | Creates a custom content type based on default settings. | |
DrupalWebTestCase:: |
protected | function | Creates a node based on default settings. | |
DrupalWebTestCase:: |
protected | function | Creates a role with specified permissions. | |
DrupalWebTestCase:: |
protected | function | Create a user with a given set of permissions. | |
DrupalWebTestCase:: |
protected | function | Retrieves a Drupal path or an absolute path. | |
DrupalWebTestCase:: |
protected | function | Retrieve a Drupal path or an absolute path and JSON decode the result. | |
DrupalWebTestCase:: |
protected | function | Gets the current raw HTML of requested page. | |
DrupalWebTestCase:: |
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… | |
DrupalWebTestCase:: |
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… | |
DrupalWebTestCase:: |
protected | function | Gets an array containing all e-mails sent during this test case. | |
DrupalWebTestCase:: |
function | Get a node from the database based on its title. | ||
DrupalWebTestCase:: |
protected | function | Gets the value of the Drupal.settings JavaScript variable for the currently loaded page. | |
DrupalWebTestCase:: |
protected | function | Get a list files that can be used in tests. | |
DrupalWebTestCase:: |
protected | function | Generate a token for the currently logged in user. | |
DrupalWebTestCase:: |
protected | function | Retrieves only the headers for a Drupal path or an absolute path. | |
DrupalWebTestCase:: |
protected | function | Log in a user with the internal browser. | |
DrupalWebTestCase:: |
protected | function | ||
DrupalWebTestCase:: |
protected | function | Execute a POST request on a Drupal page. It will be done as usual POST request with SimpleBrowser. | |
DrupalWebTestCase:: |
protected | function | Execute an Ajax submission. | |
DrupalWebTestCase:: |
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. | |
DrupalWebTestCase:: |
protected | function | Sets the value of the Drupal.settings JavaScript variable for the currently loaded page. | |
DrupalWebTestCase:: |
protected | function | Takes a path and returns an absolute path. | |
DrupalWebTestCase:: |
protected | function | Get all option elements, including nested options, in a select. | |
DrupalWebTestCase:: |
protected | function | Get the selected value from a select field. | |
DrupalWebTestCase:: |
protected | function | Returns the cache key used for the setup caching. | |
DrupalWebTestCase:: |
protected | function | Get the current URL from the cURL handler. | |
DrupalWebTestCase:: |
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. | |
DrupalWebTestCase:: |
protected | function | Copies the cached tables and files for a cached installation setup. | |
DrupalWebTestCase:: |
protected | function | Parse content returned from curlExec using DOM and SimpleXML. | |
DrupalWebTestCase:: |
protected | function | Preload the registry from the testing site. | |
DrupalWebTestCase:: |
protected | function | Generates a database prefix for running tests. | |
DrupalWebTestCase:: |
protected | function | Prepares the current environment for running the test. | |
DrupalWebTestCase:: |
protected | function | Recursively copy one directory to another. | |
DrupalWebTestCase:: |
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 |
DrupalWebTestCase:: |
protected | function | Reset all data structures after having enabled new modules. | |
DrupalWebTestCase:: |
protected | function | Store the installation setup to a cache. | |
DrupalWebTestCase:: |
protected | function | Delete created files and temporary files directory, delete the tables created by setUp(), and reset the database prefix. | 6 |
DrupalWebTestCase:: |
protected | function | Outputs to verbose the most recent $count emails sent. | |
DrupalWebTestCase:: |
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. | |
DrupalWebTestCase:: |
function |
Constructor for DrupalWebTestCase. Overrides DrupalTestCase:: |
1 | |
TMGMTBaseTestCase:: |
protected | property | List of permissions used by loginAsAdmin(). | |
TMGMTBaseTestCase:: |
protected | property | Drupal user object created by loginAsAdmin(). | |
TMGMTBaseTestCase:: |
protected | property | A default translator using the test translator. | |
TMGMTBaseTestCase:: |
protected | property |
The profile to install as a basis for testing. Overrides DrupalWebTestCase:: |
|
TMGMTBaseTestCase:: |
protected | property | List of permissions used by loginAsTranslator(). | |
TMGMTBaseTestCase:: |
protected | property | Drupal user object created by loginAsTranslator(). | |
TMGMTBaseTestCase:: |
function | Asserts job item language codes. | ||
TMGMTBaseTestCase:: |
function | Creates, saves and returns a translation job. | 1 | |
TMGMTBaseTestCase:: |
protected | function | Adds languages as admin user and switches to a translator user. | |
TMGMTBaseTestCase:: |
function | Creates, saves and returns a translator. | ||
TMGMTBaseTestCase:: |
function | Will create a user with admin permissions and log it in. | ||
TMGMTBaseTestCase:: |
function | Will create a user with translator permissions and log it in. | ||
TMGMTBaseTestCase:: |
function | Sets the proper environment. | ||
TMGMTI18nStringSourceTestCase:: |
static | function | ||
TMGMTI18nStringSourceTestCase:: |
function |
Overrides DrupalWebTestCase::setUp() Overrides TMGMTBaseTestCase:: |
||
TMGMTI18nStringSourceTestCase:: |
function | Test the i18n specific cart functionality. | ||
TMGMTI18nStringSourceTestCase:: |
function | |||
TMGMTI18nStringSourceTestCase:: |
function | Tests translation of blocks through the user interface. | ||
TMGMTI18nStringSourceTestCase:: |
function | Tests translation of fields through the user interface. | ||
TMGMTI18nStringSourceTestCase:: |
function | |||
TMGMTI18nStringSourceTestCase:: |
function | |||
TMGMTI18nStringSourceTestCase:: |
function | |||
TMGMTI18nStringSourceTestCase:: |
function | Test if the source is able to pull content in requested language. |