InstallerTranslationTest.php 1.73 KB
Newer Older
1 2 3 4 5 6 7 8 9
<?php

/**
 * @file
 * Contains \Drupal\system\Tests\Installer\InstallerTranslationTest.
 */

namespace Drupal\system\Tests\Installer;

10
use Drupal\simpletest\InstallerTestBase;
11 12

/**
13 14 15 16
 * Selects German as the installation language and verifies the following page
 * is not in English.
 *
 * @group Installer
17
 */
18
class InstallerTranslationTest extends InstallerTestBase {
19

20
  /**
21
   * Overrides the language code in which to install Drupal.
22
   *
23
   * @var string
24
   */
25
  protected $langcode = 'de';
26

27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
  /**
   * Overrides InstallerTest::setUpLanguage().
   */
  protected function setUpLanguage() {
    parent::setUpLanguage();
    // After selecting a different language than English, all following screens
    // should be translated already.
    // @todo Instead of actually downloading random translations that cannot be
    //   asserted, write and supply a German translation file. Until then, take
    //   over whichever string happens to be there, but ensure that the English
    //   string no longer appears.
    $elements = $this->xpath('//input[@type="submit"]/@value');
    $string = (string) current($elements);
    $this->assertNotEqual($string, 'Save and continue');
    $this->translations['Save and continue'] = $string;
42 43 44 45

    // Check the language direction.
    $direction = (string) current($this->xpath('/html/@dir'));
    $this->assertEqual($direction, 'ltr');
46
  }
47

48 49 50 51 52 53
  /**
   * Verifies that installation succeeded.
   */
  public function testInstaller() {
    $this->assertUrl('user/1');
    $this->assertResponse(200);
54 55 56 57

    // Ensure that we can enable basic_auth on a non-english site.
    $this->drupalPostForm('admin/modules', array('modules[Web services][basic_auth][enable]' => TRUE), t('Save configuration'));
    $this->assertResponse(200);
58 59
  }

60
}