protected function FieldCollectionEntityTranslationTestCase::removeTranslationForm in Field collection 7
Removes a translation using the entity translation form.
Parameters
mixed $node: The node to remove the translation from.
string $langcode: The language of the translation to remove.
string $source_langcode: The source language of the node.
1 call to FieldCollectionEntityTranslationTestCase::removeTranslationForm()
- FieldCollectionEntityTranslationTestCase::testEntityTranslation in ./
field_collection.test - Ensures the right behaviour in all Entity Translation use cases.
File
- ./
field_collection.test, line 989 - Tests for field_collections.
Class
- FieldCollectionEntityTranslationTestCase
- Test using field collection with content that gets translated with Entity Translation.
Code
protected function removeTranslationForm($node, $langcode, $source_langcode) {
// Number of field collection items in the source language.
$num_original_fc_items = count($node->{$this->field_name}[$source_langcode]);
// Fetch the translation edit form.
$this
->drupalGet('node/' . $node->nid . '/edit/' . $langcode);
// Remove the translation.
$this
->drupalPost(NULL, array(), t('Delete translation'));
// Confirm deletion.
$this
->drupalPost(NULL, array(), t('Delete'));
// Reload the node.
$node = node_load($node->nid, NULL, TRUE);
// Check that the translation is removed.
$this
->drupalGet('node/' . $node->nid . '/translate');
$this
->assertLinkByHref('node/' . $node->nid . '/edit/add/' . $source_langcode . '/' . $langcode, 0, 'The add translation link appears');
$this
->assert(empty($node->{$this->field_name}[$langcode]));
// Check that the field collection in the original language has not changed.
$num_fc_items = count($node->{$this->field_name}[$source_langcode]);
$this
->assertEqual($num_original_fc_items, $num_fc_items, 'The number of field collection items in the original language has not changed.');
$this
->checkFieldCollectionContent($node, $source_langcode);
}