You are here

protected function SearchNumbersTest::setUp in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/search/tests/src/Functional/SearchNumbersTest.php \Drupal\Tests\search\Functional\SearchNumbersTest::setUp()

Overrides BrowserTestBase::setUp

File

core/modules/search/tests/src/Functional/SearchNumbersTest.php, line 69

Class

SearchNumbersTest
Tests that numbers can be searched.

Namespace

Drupal\Tests\search\Functional

Code

protected function setUp() {
  parent::setUp();
  $this
    ->drupalCreateContentType([
    'type' => 'page',
    'name' => 'Basic page',
  ]);
  $this->testUser = $this
    ->drupalCreateUser([
    'search content',
    'access content',
    'administer nodes',
    'access site reports',
  ]);
  $this
    ->drupalLogin($this->testUser);
  foreach ($this->numbers as $doc => $num) {
    $info = [
      'body' => [
        [
          'value' => $num,
        ],
      ],
      'type' => 'page',
      'language' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
      'title' => $doc . ' number',
    ];
    $this->nodes[$doc] = $this
      ->drupalCreateNode($info);
  }

  // Run cron to ensure the content is indexed.
  $this
    ->cronRun();
  $this
    ->drupalGet('admin/reports/dblog');
  $this
    ->assertText(t('Cron run completed'), 'Log shows cron run completed');
}