--- core/modules/system/lib/Drupal/system/Tests/InstallerTest.php 2013-06-25 11:31:33.200509383 +0200 +++ core/modules/system/lib/Drupal/system/Tests/Installer/InstallerTranslationTest.php 2013-06-26 16:20:02.806807053 +0200 @@ -2,23 +2,23 @@ /** * @file - * Contains \Drupal\system\Tests\InstallerTest. + * Contains \Drupal\system\Tests\Installer\InstallerTranslationTest. */ -namespace Drupal\system\Tests; +namespace Drupal\system\Tests\Installer; use Drupal\Component\Utility\NestedArray; -use Drupal\simpletest\WebTestBase; +use Drupal\system\Tests\InstallerTest; /** - * Allows testing of the interactive installer. + * Tests installer translation detection. */ -class InstallerTest extends WebTestBase { +class InstallerTranslationTest extends InstallerTest { public static function getInfo() { return array( - 'name' => 'Installer tests', - 'description' => 'Tests the interactive installer.', + 'name' => 'Installer translation tests', + 'description' => "Tests the installation UI's translations.", 'group' => 'Installer', ); } @@ -33,6 +33,9 @@ // Back up the currently running SimpleTest batch. $this->originalBatch = batch_get(); + // Add the translations directory so we can retrieve german translations. + $conf['locale.settings']['translation.path'] = drupal_get_path('module', 'simpletest') . '/files/translations'; + // Create the database prefix for this test. $this->prepareDatabasePrefix(); @@ -60,6 +63,7 @@ 'path.temporary' => $this->temp_files_directory, ), 'locale.settings' => array( + 'translation.use_source' => 'local', 'translation.path' => $this->translation_files_directory, ), ); @@ -78,8 +82,24 @@ ); $this->writeSettings($settings); - $this->drupalGet($GLOBALS['base_url'] . '/core/install.php?langcode=en&profile=minimal'); - $this->drupalPost(NULL, array(), 'Save and continue'); + // Submit the installer with German language. + $this->drupalPost($GLOBALS['base_url'] . '/core/install.php', array('langcode' => 'de'), 'Save and continue'); + + // On the following page where installation profile is being selected, + // the interface should be already translated. + $this->assertNoText('Set up database', '"Set up database" string successfully translated.'); + $this->assertNoText('Save and continue', '"Save and continue" string successfully translated.'); + + // Get the "Save and continue" submit button translated value from + // the translated interface. + $submit_value = (string) current($this->xpath('//input[@type="submit"]/@value')); + + // Submit the minimal profile installation. + $this->drupalPost(NULL, array('profile' => 'minimal'), $submit_value); + + // Submit the next step. + $this->drupalPost(NULL, array(), $submit_value); + // Reload config directories. include $this->public_files_directory . '/settings.php'; $prefix = substr($this->public_files_directory, strlen(conf_path() . '/files/')); @@ -109,48 +129,4 @@ $this->setup = TRUE; } - /** - * {@inheritdoc} - * - * During setup(), drupalPost calls refreshVariables() which tries to read - * variables which are not yet there because the child Drupal is not yet - * installed. - */ - protected function refreshVariables() { - if (!empty($this->setup)) { - parent::refreshVariables(); - } - } - - /** - * {@inheritdoc} - * - * This override is necessary because the parent drupalGet() calls t(), which - * is not available early during installation. - */ - protected function drupalGet($path, array $options = array(), array $headers = array()) { - // We are re-using a CURL connection here. If that connection still has - // certain options set, it might change the GET into a POST. Make sure we - // clear out previous options. - $out = $this->curlExec(array(CURLOPT_HTTPGET => TRUE, CURLOPT_URL => $this->getAbsoluteUrl($path), CURLOPT_NOBODY => FALSE, CURLOPT_HTTPHEADER => $headers)); - $this->refreshVariables(); // Ensure that any changes to variables in the other thread are picked up. - - // Replace original page output with new output from redirected page(s). - if ($new = $this->checkForMetaRefresh()) { - $out = $new; - } - $this->verbose('GET request to: ' . $path . - '