Commit 463d8440 authored by catch's avatar catch

Issue #2614824 by alexpott, xjm, catch: Tests fail when version constant is stable

parent 47febbf6
...@@ -14,6 +14,10 @@ ...@@ -14,6 +14,10 @@
/** /**
* Ensures that node types translation work correctly. * Ensures that node types translation work correctly.
* *
* Note that the child site is installed in French; therefore, when making
* assertions on translated text it is important to provide a langcode. This
* ensures the asserts pass regardless of the Drupal version.
*
* @group node * @group node
*/ */
class NodeTypeTranslationTest extends WebTestBase { class NodeTypeTranslationTest extends WebTestBase {
...@@ -105,12 +109,16 @@ public function testNodeTypeTranslation() { ...@@ -105,12 +109,16 @@ public function testNodeTypeTranslation() {
// Check the name is translated without admin theme for editing. // Check the name is translated without admin theme for editing.
$this->drupalPostForm('admin/appearance', array('use_admin_theme' => '0'), t('Save configuration')); $this->drupalPostForm('admin/appearance', array('use_admin_theme' => '0'), t('Save configuration'));
$this->drupalGet("$langcode/node/add/$type"); $this->drupalGet("$langcode/node/add/$type");
$this->assertRaw(t('Create @name', array('@name' => $translated_name))); // This is a Spanish page, so ensure the text asserted is translated in
// Spanish and not French by adding the langcode option.
$this->assertRaw(t('Create @name', array('@name' => $translated_name), array('langcode' => $langcode)));
// Check the name is translated with admin theme for editing. // Check the name is translated with admin theme for editing.
$this->drupalPostForm('admin/appearance', array('use_admin_theme' => '1'), t('Save configuration')); $this->drupalPostForm('admin/appearance', array('use_admin_theme' => '1'), t('Save configuration'));
$this->drupalGet("$langcode/node/add/$type"); $this->drupalGet("$langcode/node/add/$type");
$this->assertRaw(t('Create @name', array('@name' => $translated_name))); // This is a Spanish page, so ensure the text asserted is translated in
// Spanish and not French by adding the langcode option.
$this->assertRaw(t('Create @name', array('@name' => $translated_name), array('langcode' => $langcode)));
} }
/** /**
...@@ -128,17 +136,19 @@ public function testNodeTypeTitleLabelTranslation() { ...@@ -128,17 +136,19 @@ public function testNodeTypeTitleLabelTranslation() {
// Assert that the title label is displayed on the translation form with the right value. // Assert that the title label is displayed on the translation form with the right value.
$this->drupalGet("admin/structure/types/manage/$type/translate/$langcode/add"); $this->drupalGet("admin/structure/types/manage/$type/translate/$langcode/add");
$this->assertRaw(t('Label')); $this->assertText('Edited title');
$this->assertRaw(t('Edited title'));
// Translate the title label. // Translate the title label.
$this->drupalPostForm(NULL, array("translation[config_names][core.base_field_override.node.$type.title][label]" => 'Translated title'), t('Save translation')); $this->drupalPostForm(NULL, array("translation[config_names][core.base_field_override.node.$type.title][label]" => 'Translated title'), t('Save translation'));
// Assert that the right title label is displayed on the node add form. // Assert that the right title label is displayed on the node add form. The
// translations are created in this test; therefore, the assertions do not
// use t(). If t() were used then the correct langcodes would need to be
// provided.
$this->drupalGet("node/add/$type"); $this->drupalGet("node/add/$type");
$this->assertRaw(t('Edited title')); $this->assertText('Edited title');
$this->drupalGet("$langcode/node/add/$type"); $this->drupalGet("$langcode/node/add/$type");
$this->assertRaw(t('Translated title')); $this->assertText('Translated title');
} }
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment