function StandardRecipeInstallTest::testStandard

Same name in other branches
  1. 10 core/tests/Drupal/FunctionalTests/Core/Recipe/StandardRecipeInstallTest.php \Drupal\FunctionalTests\Core\Recipe\StandardRecipeInstallTest::testStandard()

File

core/tests/Drupal/FunctionalTests/Core/Recipe/StandardRecipeInstallTest.php, line 55

Class

StandardRecipeInstallTest
Tests installing the Standard recipe via the installer.

Namespace

Drupal\FunctionalTests\Core\Recipe

Code

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();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.