class StandardRecipeInstallTest
Same name and namespace in other branches
- 11.x core/tests/Drupal/FunctionalTests/Core/Recipe/StandardRecipeInstallTest.php \Drupal\FunctionalTests\Core\Recipe\StandardRecipeInstallTest
Tests installing the Standard recipe via the installer.
@group #slow @group Recipe
Hierarchy
- class \Drupal\FunctionalTests\Core\Recipe\StandardRecipeInstallTest uses \Drupal\Tests\standard\Traits\StandardTestTrait, \Drupal\FunctionalTests\Core\Recipe\RecipeTestTrait
Expanded class hierarchy of StandardRecipeInstallTest
File
-
core/
tests/ Drupal/ FunctionalTests/ Core/ Recipe/ StandardRecipeInstallTest.php, line 20
Namespace
Drupal\FunctionalTests\Core\RecipeView source
class StandardRecipeInstallTest extends InstallerTestBase {
use StandardTestTrait {
testStandard as doTestStandard;
}
use RecipeTestTrait;
/**
* {@inheritdoc}
*/
protected $profile = '';
/**
* {@inheritdoc}
*/
protected function setUp() : void {
// Skip permissions hardening so we can write a services file later.
$this->settings['settings']['skip_permissions_hardening'] = (object) [
'value' => TRUE,
'required' => TRUE,
];
parent::setUp();
}
/**
* {@inheritdoc}
*/
protected function visitInstaller() : void {
// Use a URL to install from a recipe.
$this->drupalGet($GLOBALS['base_url'] . '/core/install.php' . '?profile=&recipe=core/recipes/standard');
}
/**
* {@inheritdoc}
*/
public function testStandard() : void {
if (!isset($this->rootUser->passRaw) && isset($this->rootUser->pass_raw)) {
$this->rootUser->passRaw = $this->rootUser->pass_raw;
}
// These recipes provide functionality that is only optionally part of the
// Standard profile, so we need to explicitly apply them.
$this->applyRecipe('core/recipes/editorial_workflow');
$this->applyRecipe('core/recipes/audio_media_type');
$this->applyRecipe('core/recipes/document_media_type');
$this->applyRecipe('core/recipes/image_media_type');
$this->applyRecipe('core/recipes/local_video_media_type');
$this->applyRecipe('core/recipes/remote_video_media_type');
// Add a Home link to the main menu as Standard expects "Main navigation"
// block on the page.
$this->drupalGet('admin/structure/menu/manage/main/add');
$this->submitForm([
'title[0][value]' => 'Home',
'link[0][uri]' => '<front>',
], 'Save');
// Standard expects to set the contact form's recipient email to the
// system's email address, but our feedback_contact_form recipe hard-codes
// it to another value.
// @todo This can be removed after https://drupal.org/i/3303126, which
// should make it possible for a recipe to reuse an already-set config
// value.
ContactForm::load('feedback')?->setRecipients([
'simpletest@example.com',
])->save();
// Standard ships two shortcuts; ensure they exist.
$this->assertCount(2, Shortcut::loadMultiple());
// The installer logs you in.
$this->drupalLogout();
$this->doTestStandard();
}
/**
* {@inheritdoc}
*/
protected function setUpProfile() : void {
// Noop. This form is skipped due the parameters set on the URL.
}
protected function installDefaultThemeFromClassProperty(ContainerInterface $container) : void {
// In this context a default theme makes no sense.
}
/**
* {@inheritdoc}
*/
protected function installResponsiveImage() : void {
// Overrides StandardTest::installResponsiveImage() in order to use the
// recipe.
$this->applyRecipe('core/recipes/standard_responsive_images');
}
/**
* {@inheritdoc}
*/
protected function setUpSite() : void {
$services_file = DRUPAL_ROOT . '/' . $this->siteDirectory . '/services.yml';
// $content = file_get_contents($services_file);
// Disable the super user access.
$yaml = new SymfonyYaml();
$services = [];
$services['parameters']['security.enable_super_user'] = FALSE;
file_put_contents($services_file, $yaml->dump($services));
parent::setUpSite();
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Member alias | Overriden Title | Overrides |
---|---|---|---|---|---|---|
RecipeTestTrait::applyRecipe | protected | function | Applies a recipe to the site. | |||
RecipeTestTrait::createRecipe | protected | function | Creates a recipe in a temporary directory. | |||
StandardRecipeInstallTest::$profile | protected | property | The installation profile to install. | |||
StandardRecipeInstallTest::installDefaultThemeFromClassProperty | protected | function | Installs the default theme defined by `static::$defaultTheme` when needed. | |||
StandardRecipeInstallTest::installResponsiveImage | protected | function | Installs the responsive image module. | Overrides StandardTestTrait::installResponsiveImage | ||
StandardRecipeInstallTest::setUp | protected | function | ||||
StandardRecipeInstallTest::setUpProfile | protected | function | Installer step: Select installation profile. | |||
StandardRecipeInstallTest::setUpSite | protected | function | Final installer step: Configure site. | |||
StandardRecipeInstallTest::testStandard | public | function | ||||
StandardRecipeInstallTest::visitInstaller | protected | function | Visits the interactive installer. | |||
StandardTestTrait::$adminUser | protected | property | The admin user. | |||
StandardTestTrait::testStandard | public | function | Tests Standard installation profile or recipe. | Aliased as: doTestStandard | 1 |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.