You are here

protected function PbfBaseTest::createArticles in Permissions by field 8

Generate 2 articles with standard permissions.

File

tests/src/Functional/PbfBaseTest.php, line 721

Class

PbfBaseTest
General setup and helper function for testing pbf module.

Namespace

Drupal\Tests\pbf\Functional

Code

protected function createArticles() {

  // Create articles nodes.
  $values = array(
    'type' => 'article',
    'title' => 'Article 1',
    'body' => [
      'value' => 'Content body for article 1',
    ],
    'field_pbf_group' => [
      'target_id' => $this->group1
        ->id(),
      'grant_public' => 1,
      'grant_view' => 0,
      'grant_update' => 0,
      'grant_delete' => 0,
    ],
  );
  $this->article1 = $this
    ->drupalCreateNode($values);
  $values = array(
    'type' => 'article',
    'title' => 'Article 2',
    'body' => [
      'value' => 'Content body for article 2',
    ],
    'field_pbf_group' => [
      'target_id' => $this->group1
        ->id(),
      'grant_public' => 0,
      'grant_view' => 1,
      'grant_update' => 0,
      'grant_delete' => 0,
    ],
  );
  $this->article2 = $this
    ->drupalCreateNode($values);
}