SingleVisibleProfileTest.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. namespace Drupal\FunctionalTests\Installer;
  3. use Drupal\Core\Serialization\Yaml;
  4. /**
  5. * Tests distribution profile support.
  6. *
  7. * @group Installer
  8. */
  9. class SingleVisibleProfileTest extends InstallerTestBase {
  10. /**
  11. * The installation profile to install.
  12. *
  13. * Not needed when only one is visible.
  14. *
  15. * @var string
  16. */
  17. protected $profile = NULL;
  18. /**
  19. * {@inheritdoc}
  20. */
  21. protected function prepareEnvironment() {
  22. parent::prepareEnvironment();
  23. $profiles = ['standard', 'demo_umami'];
  24. foreach ($profiles as $profile) {
  25. $info = [
  26. 'type' => 'profile',
  27. 'core' => \Drupal::CORE_COMPATIBILITY,
  28. 'name' => 'Override ' . $profile,
  29. 'hidden' => TRUE,
  30. ];
  31. // File API functions are not available yet.
  32. $path = $this->siteDirectory . '/profiles/' . $profile;
  33. mkdir($path, 0777, TRUE);
  34. file_put_contents("$path/$profile.info.yml", Yaml::encode($info));
  35. }
  36. }
  37. /**
  38. * {@inheritdoc}
  39. */
  40. protected function setUpProfile() {
  41. // This step is skipped, because there is only one visible profile.
  42. }
  43. /**
  44. * Confirms that the installation succeeded.
  45. */
  46. public function testInstalled() {
  47. $this->assertUrl('user/1');
  48. $this->assertResponse(200);
  49. // Confirm that we are logged-in after installation.
  50. $this->assertText($this->rootUser->getUsername());
  51. // Confirm that the minimal profile was installed.
  52. $this->assertEqual(drupal_get_profile(), 'minimal');
  53. }
  54. }