UserViewsDataTest.php in Drupal 10
File
core/modules/user/tests/src/Kernel/Views/UserViewsDataTest.php
View source
<?php
namespace Drupal\Tests\user\Kernel\Views;
use Drupal\KernelTests\KernelTestBase;
class UserViewsDataTest extends KernelTestBase {
protected $viewsData;
protected $entityFieldManager;
protected static $modules = [
'system',
'user',
'views',
];
protected function setUp() : void {
parent::setUp();
$this->viewsData = $this->container
->get('views.views_data');
$this->entityFieldManager = $this->container
->get('entity_field.manager');
}
public function testUserPasswordFieldNotAvailableToViews() {
$field_definitions = $this->entityFieldManager
->getBaseFieldDefinitions('user');
$this
->assertArrayHasKey('pass', $field_definitions);
$this
->assertArrayNotHasKey('pass', $this->viewsData
->get('users_field_data'));
}
}