You are here

public function PbfBasicTest::testPbfBasicAccess in Permissions by field 8

Test the "pbf" node access without custom permissions..

  • Test access with standard permissions.
  • Access to each node
  • Search the node and count result.

File

tests/src/Functional/PbfBasicTest.php, line 28

Class

PbfBasicTest
Test basic access without pbf fields.

Namespace

Drupal\Tests\pbf\Functional

Code

public function testPbfBasicAccess() {
  $this
    ->drupalLogin($this->normalUser);
  $this
    ->drupalGet('node/' . $this->article1
    ->id());
  $this
    ->assertResponse(200);
  $this
    ->assertTitle('Article 1 | Drupal', t('Correct title for article 1 found'));
  $this
    ->drupalGet('node/' . $this->article2
    ->id());
  $this
    ->assertResponse(200);
  $this
    ->assertTitle('Article 2 | Drupal', t('Correct title for article 2 found'));
  $this
    ->drupalGet('node/' . $this->group1
    ->id());
  $this
    ->assertResponse(200);
  $this
    ->assertTitle('Group 1 | Drupal', t('Correct title for group 1 found'));
  $this
    ->drupalGet('node/' . $this->group2
    ->id());
  $this
    ->assertResponse(200);
  $this
    ->assertTitle('Group 2 | Drupal', t('Correct title for group 2 found'));

  // Build the search index.
  $this->container
    ->get('cron')
    ->run();

  // Check to see that we find the number of search results expected.
  $this
    ->checkSearchResults('Article', 2);
  $this
    ->drupalLogout();
  $this
    ->drupalGet('node/' . $this->article1
    ->id());
  $this
    ->assertResponse(200);
  $this
    ->drupalGet('node/' . $this->article2
    ->id());
  $this
    ->assertResponse(200);
}