protected function GroupToGroupContentRelationshipTest::setUp in Group 8
Same name and namespace in other branches
- 2.0.x tests/src/Kernel/Views/GroupToGroupContentRelationshipTest.php \Drupal\Tests\group\Kernel\Views\GroupToGroupContentRelationshipTest::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/ GroupToGroupContentRelationshipTest.php, line 51
Class
- GroupToGroupContentRelationshipTest
- Tests the group_to_group_content 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
->installTestConfiguration();
$this
->setCurrentUser($this
->createUser());
// Enable the 'user_as_content' plugin on the 'default' group type.
$group_type = $this->entityTypeManager
->getStorage('group_type')
->load('default');
/** @var \Drupal\group\Entity\Storage\GroupContentTypeStorageInterface $storage */
$storage = $this->entityTypeManager
->getStorage('group_content_type');
$storage
->createFromPlugin($group_type, 'user_as_content')
->save();
ViewTestData::createTestViews(get_class($this), [
'group_test_views',
]);
}