You are here

protected function CartLinksTest::setUp in Ubercart 8.4

Sets up a Drupal site for running functional and integration tests.

Installs Drupal with the installation profile specified in \Drupal\simpletest\WebTestBase::$profile into the prefixed database.

Afterwards, installs any additional modules specified in the static \Drupal\simpletest\WebTestBase::$modules property of each class in the class hierarchy.

After installation all caches are flushed and several configuration values are reset to the values of the parent site executing the test, since the default values may be incompatible with the environment in which tests are being executed.

Overrides UbercartTestBase::setUp

File

uc_cart_links/src/Tests/CartLinksTest.php, line 27

Class

CartLinksTest
Tests the Cart Links functionality.

Namespace

Drupal\uc_cart_links\Tests

Code

protected function setUp() {
  parent::setUp();

  // Set front page so we have someplace to redirect to for invalid Cart Links.
  \Drupal::configFactory()
    ->getEditable('system.site')
    ->set('page.front', '/node')
    ->save();

  // Need page_title_block because we test page titles.
  $this
    ->drupalPlaceBlock('page_title_block');

  // System help block is needed to see output from hook_help().
  $this
    ->drupalPlaceBlock('help_block', [
    'region' => 'help',
  ]);

  // Testing profile doesn't include a 'page' content type.
  // We will need this to create pages with links on them.
  $this
    ->drupalCreateContentType([
    'type' => 'page',
    'name' => 'Basic page',
  ]);

  // Create Full HTML text format, needed because we want links
  // to appear on pages.
  $full_html_format = FilterFormat::create([
    'format' => 'full_html',
    'name' => 'Full HTML',
  ]);
  $full_html_format
    ->save();
}