protected function GroupManagerSubscriptionTest::setUp in Organic groups 8
Overrides KernelTestBase::setUp
File
- tests/
src/ Kernel/ GroupManagerSubscriptionTest.php, line 57
Class
- GroupManagerSubscriptionTest
- Tests if the group manager is subscribed automatically upon group creation.
Namespace
Drupal\Tests\og\KernelCode
protected function setUp() : void {
parent::setUp();
$this->groupTypeManager = $this->container
->get('og.group_type_manager');
$this->membershipManager = $this->container
->get('og.membership_manager');
// Add membership and config schema.
$this
->installConfig([
'og',
]);
$this
->installEntitySchema('node');
$this
->installEntitySchema('og_membership');
$this
->installEntitySchema('user');
$this
->installSchema('system', [
'sequences',
]);
// Create a group type.
NodeType::create([
'name' => $this
->randomString(),
'type' => 'group',
])
->save();
$this->groupTypeManager
->addGroup('node', 'group');
// Create a test group owner.
$this->owner = User::create([
'name' => $this
->randomString(),
]);
$this->owner
->save();
// Create a custom role that will be used to check if other modules can
// override the membership that is created by default.
$role = OgRole::create();
$role
->setName('moderator')
->setLabel($this
->randomString())
->setGroupType('node')
->setGroupBundle('group')
->save();
}