You are here

public function FunctionalTestBase::setUp in Search API Pages 8

Overrides BrowserTestBase::setUp

5 calls to FunctionalTestBase::setUp()
BlockTest::setUp in tests/src/Functional/BlockTest.php
FacetsIntegrationTest::setUp in tests/src/Functional/FacetsIntegrationTest.php
LanguageIntegrationTest::setUp in tests/src/Functional/LanguageIntegrationTest.php
ParseModeTest::setUp in tests/src/Functional/ParseModeTest.php
ViewModeTest::setUp in tests/src/Functional/ViewModeTest.php
5 methods override FunctionalTestBase::setUp()
BlockTest::setUp in tests/src/Functional/BlockTest.php
FacetsIntegrationTest::setUp in tests/src/Functional/FacetsIntegrationTest.php
LanguageIntegrationTest::setUp in tests/src/Functional/LanguageIntegrationTest.php
ParseModeTest::setUp in tests/src/Functional/ParseModeTest.php
ViewModeTest::setUp in tests/src/Functional/ViewModeTest.php

File

tests/src/Functional/FunctionalTestBase.php, line 76

Class

FunctionalTestBase
Class FunctionalTestBase.

Namespace

Drupal\Tests\search_api_page\Functional

Code

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

  // Create the users used for the tests.
  $this->adminUser = $this
    ->drupalCreateUser([
    'administer search_api',
    'administer search_api_page',
    'access administration pages',
    'administer nodes',
    'access content overview',
    'administer content types',
    'administer blocks',
    'view search api pages',
    'administer node display',
  ]);
  $this->unauthorizedUser = $this
    ->drupalCreateUser();
  $this->anonymousUser = $this
    ->drupalCreateUser([
    'view search api pages',
  ]);

  // Create article content type and content.
  $this
    ->drupalCreateContentType([
    'type' => 'article',
  ]);
  for ($i = 1; $i < 50; $i++) {
    $body = "Body number{$i} \n Value of the body: ";
    if ($i % 3 === 0) {
      $body .= "\n lorem ipsum";
    }
    if ($i % 5 === 0) {
      $body .= "\n Owls are birds from the order Strigiformes, which includes about 200 species of mostly solitary and nocturnal birds of prey.";
    }
    if ($i % 10 === 0) {
      $body .= "\n Owls are typified by an upright stance, a large, broad head, binocular vision, binaural hearing, sharp talons, and feathers adapted for silent flight. Exceptions include the diurnal northern hawk-owl and the gregarious burrowing owl.";
    }
    $this
      ->drupalCreateNode([
      'title' => 'Item number' . $i,
      'type' => 'article',
      'body' => [
        [
          'value' => $body,
        ],
      ],
    ]);
  }
}