You are here

protected function PbfBaseTest::createSimpleArticle in Permissions by field 8

Create an article with value for Pbf field.

Parameters

string $title: The content title.

string $field_name: The Pbf field name to populate.

int|string $target_id: The target id of Pbf field.

int $grant_public: The grant public value.

int $grant_view: The grant view value.

int $grant_update: The grant update value.

int $grant_delete: The grant delete value.

Return value

\Drupal\node\NodeInterface The node created.

8 calls to PbfBaseTest::createSimpleArticle()
PbfAccessByNodeRefTest::setUp in tests/src/Functional/PbfAccessByNodeRefTest.php
Setup and create content whith Pbf field.
PbfAccessByRoleTest::setUp in tests/src/Functional/PbfAccessByRoleTest.php
Setup and create content whith Pbf field.
PbfAccessByTermRefTest::setUp in tests/src/Functional/PbfAccessByTermRefTest.php
Setup and create content with Pbf field.
PbfAccessByUserDirectTest::setUp in tests/src/Functional/PbfAccessByUserDirectTest.php
Setup and create content whith Pbf field.
PbfAccessByUserRefTest::setUp in tests/src/Functional/PbfAccessByUserRefTest.php
Setup and create content whith Pbf field.

... See full list

File

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

Class

PbfBaseTest
General setup and helper function for testing pbf module.

Namespace

Drupal\Tests\pbf\Functional

Code

protected function createSimpleArticle($title, $field_name = '', $target_id = NULL, $grant_public = 1, $grant_view = 0, $grant_update = 0, $grant_delete = 0) {
  $values = array(
    'type' => 'article',
    'title' => $title,
    'body' => [
      'value' => 'Content body for ' . $title,
    ],
  );
  if ($field_name) {
    $values[$field_name] = [
      'target_id' => $target_id,
      'grant_public' => $grant_public,
      'grant_view' => $grant_view,
      'grant_update' => $grant_update,
      'grant_delete' => $grant_delete,
    ];
  }
  return $this
    ->drupalCreateNode($values);
}