public function UserViewsFieldAccessTest::testUserFields in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/user/src/Tests/Views/UserViewsFieldAccessTest.php \Drupal\user\Tests\Views\UserViewsFieldAccessTest::testUserFields()
File
- core/
modules/ user/ src/ Tests/ Views/ UserViewsFieldAccessTest.php, line 35 - Contains \Drupal\user\Tests\Views\UserViewsFieldAccessTest.
Class
- UserViewsFieldAccessTest
- Tests base field access in Views for the user entity.
Namespace
Drupal\user\Tests\ViewsCode
public function testUserFields() {
ConfigurableLanguage::create([
'id' => 'es',
'name' => 'Spanish',
])
->save();
ConfigurableLanguage::create([
'id' => 'fr',
'name' => 'French',
])
->save();
$user = User::create([
'name' => 'test user',
'mail' => 'druplicon@drop.org',
'status' => 1,
'preferred_langcode' => 'es',
'preferred_admin_langcode' => 'fr',
'timezone' => 'ut1',
'created' => 123456,
]);
$user
->save();
// @todo Expand the test coverage in https://www.drupal.org/node/2464635
$this
->assertFieldAccess('user', 'uid', $user
->id());
$this
->assertFieldAccess('user', 'uuid', $user
->uuid());
$this
->assertFieldAccess('user', 'langcode', $user
->language()
->getName());
$this
->assertFieldAccess('user', 'preferred_langcode', 'Spanish');
$this
->assertFieldAccess('user', 'preferred_admin_langcode', 'French');
$this
->assertFieldAccess('user', 'name', 'test user');
// $this->assertFieldAccess('user', 'mail', 'druplicon@drop.org');
$this
->assertFieldAccess('user', 'timezone', 'ut1');
$this
->assertFieldAccess('user', 'status', 'On');
// $this->assertFieldAccess('user', 'created', \Drupal::service('date.formatter')->format(123456));
// $this->assertFieldAccess('user', 'changed', \Drupal::service('date.formatter')->format(REQUEST_TIME));
}