InstallerTranslationTest.php 1.92 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

/**
 * Tests the installer translation detection.
 */
15
class InstallerTranslationTest extends InstallerTestBase {
16

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

24 25 26 27 28 29 30 31
  public static function getInfo() {
    return array(
      'name' => 'Installer translation test',
      'description' => 'Selects German as the installation language and verifies the following page is not in English.',
      'group' => 'Installer',
    );
  }

32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
  /**
   * 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;
47 48 49 50

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

53 54 55 56 57 58
  /**
   * Verifies that installation succeeded.
   */
  public function testInstaller() {
    $this->assertUrl('user/1');
    $this->assertResponse(200);
59 60 61 62

    // 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);
63 64
  }

65
}