SiteNameTest.php

Same filename in other branches
  1. 9 core/tests/Drupal/FunctionalTests/Installer/SiteNameTest.php
  2. 8.9.x core/tests/Drupal/FunctionalTests/Installer/SiteNameTest.php
  3. 11.x core/tests/Drupal/FunctionalTests/Installer/SiteNameTest.php

Namespace

Drupal\FunctionalTests\Installer

File

core/tests/Drupal/FunctionalTests/Installer/SiteNameTest.php

View source
<?php

declare (strict_types=1);
namespace Drupal\FunctionalTests\Installer;

use Drupal\Tests\BrowserTestBase;

/**
 * Tests that the site name can be set during a non-interactive installation.
 *
 * @group Installer
 */
class SiteNameTest extends BrowserTestBase {
    
    /**
     * The site name to be used when testing.
     *
     * @var string
     */
    protected $siteName;
    
    /**
     * {@inheritdoc}
     */
    protected $defaultTheme = 'stark';
    
    /**
     * {@inheritdoc}
     */
    protected function installParameters() {
        $this->siteName = $this->randomMachineName();
        $parameters = parent::installParameters();
        $parameters['forms']['install_configure_form']['site_name'] = $this->siteName;
        return $parameters;
    }
    
    /**
     * Tests that the desired site name appears on the page after installation.
     */
    public function testSiteName() : void {
        $this->drupalGet('');
        $this->assertSession()
            ->pageTextContains($this->siteName);
    }

}

Classes

Title Deprecated Summary
SiteNameTest Tests that the site name can be set during a non-interactive installation.

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