You are here

protected function EntityContext::getCurrentUserUid in Lightning Core 8.5

Same name and namespace in other branches
  1. 8.3 tests/contexts/EntityContext.behat.inc \Acquia\LightningExtension\Context\EntityContext::getCurrentUserUid()
  2. 8.4 tests/contexts/EntityContext.behat.inc \Acquia\LightningExtension\Context\EntityContext::getCurrentUserUid()

Gets the current user's UID.

Return value

int Returns the current user's UID if there is one or 0 if not.

2 calls to EntityContext::getCurrentUserUid()
EntityContext::onNodeCreate in tests/contexts/EntityContext.behat.inc
Reacts when a node is created by Drupal Extension's step definition.
EntityContext::save in tests/contexts/EntityContext.behat.inc
Saves an entity, ensuring automatic clean-up.

File

tests/contexts/EntityContext.behat.inc, line 259

Class

EntityContext
Contains miscellaneous step definitions for working with Drupal entities.

Namespace

Acquia\LightningExtension\Context

Code

protected function getCurrentUserUid() {
  $user = $this
    ->getUserManager()
    ->getCurrentUser();
  return $user ? $user->uid : 0;
}