Chris@16: info = [ Chris@16: 'type' => 'profile', Chris@16: 'core' => \Drupal::CORE_COMPATIBILITY, Chris@16: 'name' => 'Distribution profile', Chris@16: 'distribution' => [ Chris@16: 'name' => 'My Distribution', Chris@16: 'langcode' => $this->langcode, Chris@16: 'install' => [ Chris@16: 'theme' => 'bartik', Chris@16: ], Chris@16: ], Chris@16: ]; Chris@16: // File API functions are not available yet. Chris@16: $path = $this->root . DIRECTORY_SEPARATOR . $this->siteDirectory . '/profiles/mydistro'; Chris@16: mkdir($path, 0777, TRUE); Chris@16: file_put_contents("$path/mydistro.info.yml", Yaml::encode($this->info)); Chris@16: // Place a custom local translation in the translations directory. Chris@16: mkdir($this->root . '/' . $this->siteDirectory . '/files/translations', 0777, TRUE); Chris@16: file_put_contents($this->root . '/' . $this->siteDirectory . '/files/translations/drupal-8.0.0.de.po', $this->getPo('de')); Chris@16: file_put_contents($this->root . '/' . $this->siteDirectory . '/files/translations/drupal-8.0.0.fr.po', $this->getPo('fr')); Chris@16: } Chris@16: Chris@16: /** Chris@16: * {@inheritdoc} Chris@16: */ Chris@16: protected function visitInstaller() { Chris@16: // Pass a different language code than the one set in the distribution Chris@16: // profile. This distribution language should still be used. Chris@16: // The unrouted URL assembler does not exist at this point, so we build the Chris@16: // URL ourselves. Chris@16: $this->drupalGet($GLOBALS['base_url'] . '/core/install.php' . '?langcode=fr'); Chris@16: } Chris@16: Chris@16: /** Chris@16: * {@inheritdoc} Chris@16: */ Chris@16: protected function setUpLanguage() { Chris@16: // This step is skipped, because the distribution profile uses a fixed Chris@16: // language. Chris@16: } Chris@16: Chris@16: /** Chris@16: * {@inheritdoc} Chris@16: */ Chris@16: protected function setUpProfile() { Chris@16: // This step is skipped, because there is a distribution profile. Chris@16: } Chris@16: Chris@16: /** Chris@16: * {@inheritdoc} Chris@16: */ Chris@16: protected function setUpSettings() { Chris@16: // The language should have been automatically detected, all following Chris@16: // screens should be translated already. Chris@16: $elements = $this->xpath('//input[@type="submit"]/@value'); Chris@16: $this->assertEqual(current($elements)->getText(), 'Save and continue de'); Chris@16: $this->translations['Save and continue'] = 'Save and continue de'; Chris@16: Chris@16: // Check the language direction. Chris@16: $direction = $this->getSession()->getPage()->find('xpath', '/@dir')->getText(); Chris@16: $this->assertEqual($direction, 'ltr'); Chris@16: Chris@16: // Verify that the distribution name appears. Chris@16: $this->assertRaw($this->info['distribution']['name']); Chris@16: // Verify that the requested theme is used. Chris@16: $this->assertRaw($this->info['distribution']['install']['theme']); Chris@16: // Verify that the "Choose profile" step does not appear. Chris@16: $this->assertNoText('profile'); Chris@16: Chris@16: parent::setUpSettings(); Chris@16: } Chris@16: Chris@16: /** Chris@16: * Confirms that the installation succeeded. Chris@16: */ Chris@16: public function testInstalled() { Chris@16: $this->assertUrl('user/1'); Chris@16: $this->assertResponse(200); Chris@16: Chris@16: // Confirm that we are logged-in after installation. Chris@16: $this->assertText($this->rootUser->getDisplayName()); Chris@16: Chris@16: // Verify German was configured but not English. Chris@16: $this->drupalGet('admin/config/regional/language'); Chris@16: $this->assertText('German'); Chris@16: $this->assertNoText('English'); Chris@16: } Chris@16: Chris@16: /** Chris@16: * Returns the string for the test .po file. Chris@16: * Chris@16: * @param string $langcode Chris@16: * The language code. Chris@16: * @return string Chris@16: * Contents for the test .po file. Chris@16: */ Chris@16: protected function getPo($langcode) { Chris@16: return <<