Test the node type for a single checkout.
function testSimpleConfiguration() {
$this
->loginAsTranslator(array(
'translate configuration',
));
// Go to the translate tab.
$this
->drupalGet('admin/config/system/site-information/translate');
// Assert some basic strings on that page.
$this
->assertSession()
->pageTextContains('Translations of System information');
// Request a translation for german.
$edit = array(
'languages[de]' => TRUE,
);
$this
->submitForm($edit, 'Request translation');
// Verify that we are on the translate tab.
$this
->assertSession()
->pageTextContains('One job needs to be checked out.');
$this
->assertSession()
->pageTextContains('System information (English to German, Unprocessed)');
// Submit.
$this
->submitForm([], 'Submit to provider');
// Make sure that we're back on the originally defined destination URL.
$this
->assertSession()
->addressEquals('admin/config/system/site-information/translate');
// We are redirected back to the correct page.
$this
->drupalGet('admin/config/system/site-information/translate');
// Translated languages should now be listed as Needs review.
$rows = $this
->xpath('//tbody/tr');
$found = FALSE;
foreach ($rows as $value) {
$image = $value
->find('css', 'td:nth-child(3) a img');
if ($image && $image
->getAttribute('title') == 'Needs review') {
$found = TRUE;
$this
->assertEquals('German', $value
->find('css', 'td:nth-child(2)')
->getText());
}
}
$this
->assertTrue($found);
// Verify that the pending translation is shown.
$this
->clickLinkWithImageTitle('Needs review');
$this
->submitForm([
'name[translation]' => 'de_Druplicon',
], 'Save');
$this
->clickLinkWithImageTitle('Needs review');
$this
->assertSession()
->pageTextContains('de_Druplicon');
$this
->submitForm([], 'Save');
// Request a spanish translation.
$edit = array(
'languages[es]' => TRUE,
);
$this
->submitForm($edit, 'Request translation');
// Verify that we are on the checkout page.
$this
->assertSession()
->pageTextContains('One job needs to be checked out.');
$this
->assertSession()
->pageTextContains('System information (English to Spanish, Unprocessed)');
$this
->submitForm([], 'Submit to provider');
// Make sure that we're back on the originally defined destination URL.
$this
->assertSession()
->addressEquals('admin/config/system/site-information/translate');
// Translated languages should now be listed as Needs review.
$rows = $this
->xpath('//tbody/tr');
$counter = 0;
foreach ($rows as $value) {
$image = $value
->find('css', 'td:nth-child(3) a img');
if ($image && $image
->getAttribute('title') == 'Needs review') {
$this
->assertTrue(in_array($value
->find('css', 'td:nth-child(2)')
->getText(), [
'Spanish',
'German',
]));
$counter++;
}
}
$this
->assertEquals(2, $counter);
// Test translation and validation tags of account settings.
$this
->drupalGet('admin/config/people/accounts/translate');
$this
->submitForm([
'languages[de]' => TRUE,
], 'Request translation');
// Submit.
$this
->submitForm([], 'Submit to provider');
$this
->clickLinkWithImageTitle('Needs review');
$this
->submitForm([
'user__settings|anonymous[translation]' => 'de_Druplicon',
], 'Validate HTML tags');
$this
->assertSession()
->pageTextContains('de_Druplicon');
$this
->submitForm([], 'Save');
$this
->clickLinkWithImageTitle('Needs review');
$this
->assertSession()
->pageTextContains('de_Druplicon');
}