GroupTypeTest.php in Organic groups 8
File
tests/src/Kernel/Entity/GroupTypeTest.php
View source
<?php
declare (strict_types=1);
namespace Drupal\Tests\og\Kernel\Entity;
use Drupal\KernelTests\KernelTestBase;
use Drupal\node\Entity\NodeType;
class GroupTypeTest extends KernelTestBase {
public static $modules = [
'field',
'node',
'og',
'system',
'user',
];
protected $groupTypeManager;
protected function setUp() : void {
parent::setUp();
$this
->installConfig([
'og',
]);
$this->groupTypeManager = $this->container
->get('og.group_type_manager');
}
public function testGroupType() {
$group_type = NodeType::create([
'type' => 'group',
'name' => 'Group',
]);
$group_type
->save();
$this
->assertFalse($this->groupTypeManager
->isGroup('node', 'group'));
$this->groupTypeManager
->addGroup('node', 'group');
$this
->assertTrue($this->groupTypeManager
->isGroup('node', 'group'));
$group_type
->delete();
$this
->assertFalse($this->groupTypeManager
->isGroup('node', 'group'));
}
}