protected function GroupContentToEntityRelationshipTest::setUp in Group 2.0.x
Same name and namespace in other branches
- 8 tests/src/Kernel/Views/GroupContentToEntityRelationshipTest.php \Drupal\Tests\group\Kernel\Views\GroupContentToEntityRelationshipTest::setUp()
Parameters
bool $import_test_views: Should the views specified on the test class be imported. If you need to setup some additional stuff, like fields, you need to call false and then call createTestViews for your own.
Overrides ViewsKernelTestBase::setUp
File
- tests/
src/ Kernel/ Views/ GroupContentToEntityRelationshipTest.php, line 50
Class
- GroupContentToEntityRelationshipTest
- Tests the group_content_to_entity relationship handler.
Namespace
Drupal\Tests\group\Kernel\ViewsCode
protected function setUp($import_test_views = TRUE) {
parent::setUp($import_test_views);
$this->entityTypeManager = $this->container
->get('entity_type.manager');
$this
->installEntitySchema('user');
$this
->installEntitySchema('group');
$this
->installEntitySchema('group_type');
$this
->installEntitySchema('group_content');
$this
->installEntitySchema('group_content_type');
$this
->installConfig([
'group',
'field',
'group_test_config',
]);
// Set the current user so group creation can rely on it.
$this->container
->get('current_user')
->setAccount($this
->createUser());
// Enable the user_as_content plugin on the default group type.
/** @var \Drupal\group\Entity\Storage\GroupContentTypeStorageInterface $storage */
$group_type = $this->entityTypeManager
->getStorage('group_type')
->load('default');
$storage = $this->entityTypeManager
->getStorage('group_content_type');
$storage
->createFromPlugin($group_type, 'user_as_content')
->save();
ViewTestData::createTestViews(get_class($this), [
'group_test_views',
]);
}