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