You are here

protected function AgreementTestBase::setUp in Agreement 3.0.x

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/AgreementTestBase.php \Drupal\Tests\agreement\Functional\AgreementTestBase::setUp()

Overrides BrowserTestBase::setUp

7 calls to AgreementTestBase::setUp()
AgreementAccessDeniedRedirectTest::setUp in tests/src/Functional/AgreementAccessDeniedRedirectTest.php
AgreementAnonymousTest::setUp in tests/src/Functional/AgreementAnonymousTest.php
AgreementCustomFrequencyTest::setUp in tests/src/Functional/AgreementCustomFrequencyTest.php
AgreementCustomUnprivilegedUserTest::setUp in tests/src/Functional/AgreementCustomUnprivilegedUserTest.php
AgreementMultilingualTest::setUp in tests/src/Functional/AgreementMultilingualTest.php

... See full list

7 methods override AgreementTestBase::setUp()
AgreementAccessDeniedRedirectTest::setUp in tests/src/Functional/AgreementAccessDeniedRedirectTest.php
AgreementAnonymousTest::setUp in tests/src/Functional/AgreementAnonymousTest.php
AgreementCustomFrequencyTest::setUp in tests/src/Functional/AgreementCustomFrequencyTest.php
AgreementCustomUnprivilegedUserTest::setUp in tests/src/Functional/AgreementCustomUnprivilegedUserTest.php
AgreementMultilingualTest::setUp in tests/src/Functional/AgreementMultilingualTest.php

... See full list

File

tests/src/Functional/AgreementTestBase.php, line 60

Class

AgreementTestBase
Tests the agreement functionality.

Namespace

Drupal\Tests\agreement\Functional

Code

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

  // Set front page to "node".
  \Drupal::configFactory()
    ->getEditable('system.site')
    ->set('page.front', '/node')
    ->save(TRUE);

  // Create page type.
  $this
    ->createContentType([
    'type' => 'page',
    'name' => 'Page',
  ]);
  $this->container
    ->get('router.builder')
    ->rebuild();

  // Create a page nodes.

  /* @var \Drupal\node\Entity\Node node */
  $this->node = $this
    ->createNode();

  /** @var \Drupal\node\Entity\Node node */
  $this->otherNode = $this
    ->createNode();

  // Load the default agreement.
  $this->agreement = $this->container
    ->get('entity_type.manager')
    ->getStorage('agreement')
    ->load('default');

  // Set the usual default for the test.
  $settings = $this->agreement
    ->getSettings();
  $settings['visibility']['pages'] = [
    '<front>',
  ];
  $this->agreement
    ->set('settings', $settings);
  $this->agreement
    ->save();
  $this
    ->assertEquals($settings, $this->agreement
    ->getSettings());
}