protected function GroupTabTest::setUp in Organic groups 8
Overrides BrowserTestBase::setUp
File
- tests/
src/ Functional/ GroupTabTest.php, line 60
Class
- GroupTabTest
- Tests the "Group" tab.
Namespace
Drupal\Tests\og\FunctionalCode
protected function setUp() : void {
parent::setUp();
// Create bundles.
$this->bundle1 = mb_strtolower($this
->randomMachineName());
$this->bundle2 = mb_strtolower($this
->randomMachineName());
// Create node types.
$node_type1 = NodeType::create([
'type' => $this->bundle1,
'name' => $this->bundle1,
]);
$node_type1
->save();
$node_type2 = NodeType::create([
'type' => $this->bundle2,
'name' => $this->bundle2,
]);
$node_type2
->save();
// Define the first bundle as group.
Og::groupTypeManager()
->addGroup('node', $this->bundle1);
// Create node author user.
$user = $this
->createUser();
// Create nodes.
$this->group = Node::create([
'type' => $this->bundle1,
'title' => $this
->randomString(),
'uid' => $user
->id(),
]);
$this->group
->save();
$this->nonGroup = Node::create([
'type' => $this->bundle2,
'title' => $this
->randomString(),
'uid' => $user
->id(),
]);
$this->nonGroup
->save();
$this->user1 = $this
->drupalCreateUser([
'administer organic groups',
]);
}