Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drupal.org/node/2535716 #3

Open
wants to merge 2 commits into
base: 7.x-1.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ branches:
matrix:
fast_finish: true
allow_failures:
- php: hhvm
- php: 7
- php: hhvm

env:
global:
Expand Down
35 changes: 34 additions & 1 deletion drafty.test
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ class DraftyFieldCollectionTest extends DraftyWebTestCase {
/**
* Test draft revisions with entity translation.
*/
class DraftyEtTest extends EntityTranslationTestCase {
class DraftyEtTest extends EntityTranslationTestCase {
public static function getInfo() {
return array(
'name' => 'Drafty Entity Translation',
Expand All @@ -281,6 +281,39 @@ class DraftyEtTest extends EntityTranslationTestCase {
$this->login($this->getTranslatorUser());
}

/**

* Create a translation.
*
* This overrides because with drafty, asserting an 'edit' link for a
* translation fails when the revision with the added translation has not yet
* been published.
*
* @param $node
* Node of the basic page to create translation for.
* @param $title
* Title of the basic page in the specified language.
* @param $body
* Body of the basic page in the specified language.
* @param $langcode
* The language code to be assigned to the specified values.
*/
function createTranslation($node, $title, $body, $langcode, $source_langcode = 'en') {
$this->drupalGet('node/' . $node->nid . '/edit/add/' . $source_langcode . '/' . $langcode);

$body_key = "body[$langcode][0][value]";
$this->assertFieldByXPath("//textarea[@name='$body_key']", $node->body[$source_langcode][0]['value'], 'Original body value correctly populated.');
$this->assertFieldById('edit-body-' . $langcode . '-add-more', t('Add another item'), t('Add another item button found.'));

$edit = array();
$edit[$body_key] = $body;

$this->drupalPost(NULL, $edit, t('Save'));
$this->drupalGet('node/' . $node->nid . '/translate');

return $node;
}

/**
* Test if field based translation works.
*
Expand Down
32 changes: 32 additions & 0 deletions modules/drafty_1992010/drafty_1992010.test
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,38 @@ class Drafty1992010Test extends EntityTranslationTestCase {
$this->login($this->getTranslatorUser());
}

/**
* Create a translation.
*
* This overrides because with drafty, asserting an 'edit' link for a
* translation fails when the revision with the added translation has not yet
* been published.
*
* @param $node
* Node of the basic page to create translation for.
* @param $title
* Title of the basic page in the specified language.
* @param $body
* Body of the basic page in the specified language.
* @param $langcode
* The language code to be assigned to the specified values.
*/
function createTranslation($node, $title, $body, $langcode, $source_langcode = 'en') {
$this->drupalGet('node/' . $node->nid . '/edit/add/' . $source_langcode . '/' . $langcode);

$body_key = "body[$langcode][0][value]";
$this->assertFieldByXPath("//textarea[@name='$body_key']", $node->body[$source_langcode][0]['value'], 'Original body value correctly populated.');
$this->assertFieldById('edit-body-' . $langcode . '-add-more', t('Add another item'), t('Add another item button found.'));

$edit = array();
$edit[$body_key] = $body;

$this->drupalPost(NULL, $edit, t('Save'));
$this->drupalGet('node/' . $node->nid . '/translate');

return $node;
}

/**
* Test if field based translation works.
*
Expand Down