function UserEntityTest::testGetLastAccessedTime

Tests that ::getLastAccessedTime() returns an integer for a loaded user.

@legacy-covers ::getLastAccessedTime

File

core/modules/user/tests/src/Kernel/UserEntityTest.php, line 116

Class

UserEntityTest
Tests the user entity class.

Namespace

Drupal\Tests\user\Kernel

Code

public function testGetLastAccessedTime() : void {
  $access = 100;
  /** @var \Drupal\user\Entity\User $user */
  $user = User::create([
    'name' => $this->randomMachineName(),
    'access' => $access,
  ]);
  $id = $user->save();
  $loaded_user = User::load($id);
  $this->assertSame($access, $loaded_user->getLastAccessedTime());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.