You are here

protected function PbfBaseTest::setUserField in Permissions by field 8

Set the value of field_name attached to user.

Parameters

int $uid: The user uid.

string $field_name: The field name to set.

array $value: The values of field name.

4 calls to PbfBaseTest::setUserField()
PbfAccessByNodeRefTest::testPbfAccessByNodeRef in tests/src/Functional/PbfAccessByNodeRefTest.php
Test the "pbf" node access with a Pbf field which reference node.
PbfAccessByTermRefTest::testPbfAccessByTermRef in tests/src/Functional/PbfAccessByTermRefTest.php
Test the "pbf" node access with a Pbf field which reference term.
PbfAccessByUserRefTest::testPbfAccessByUserRef in tests/src/Functional/PbfAccessByUserRefTest.php
Test the "pbf" node access with a Pbf field which reference user.
PbfAccessWithFormWidgetValueTest::testPbfAccessWithFormWidget in tests/src/Functional/PbfAccessWithFormWidgetValueTest.php
Test the pbf node access with a Pbf field with grants value from widget.

File

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

Class

PbfBaseTest
General setup and helper function for testing pbf module.

Namespace

Drupal\Tests\pbf\Functional

Code

protected function setUserField($uid, $field_name = '', $value = NULL) {
  if ($field_name) {
    User::load($uid)
      ->set($field_name, $value)
      ->save();
  }
}