InstallerTranslationTest.php 1.83 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
47
  /**
   * 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;
  }
48

49
50
51
52
53
54
55
56
57
58
59
  /**
   * Overrides InstallerTest::setUpConfirm().
   */
  protected function setUpConfirm() {
    // We don't know the translated link text of "Visit your new site", but
    // luckily, there is only one link.
    $elements = $this->xpath('//a');
    $string = (string) current($elements);
    $this->assertNotEqual($string, 'Visit your new site');
    $this->translations['Visit your new site'] = $string;
    parent::setUpConfirm();
60
61
62
  }

}