AutoEntityLabelPermissionControllerTest.php in Automatic Entity Label 8.3
File
tests/src/Kernel/AutoEntityLabelPermissionControllerTest.php
View source
<?php
namespace Drupal\Tests\auto_entitylabel\Kernel;
use Drupal\auto_entitylabel\AutoEntityLabelPermissionController;
use Drupal\KernelTests\Core\Entity\EntityKernelTestBase;
use Drupal\Tests\node\Traits\ContentTypeCreationTrait;
class AutoEntityLabelPermissionControllerTest extends EntityKernelTestBase {
use ContentTypeCreationTrait;
protected $nodeType;
protected $autoEntityLabelPermissionController;
public static $modules = [
'system',
'user',
'node',
'auto_entitylabel',
];
protected function setUp() {
parent::setUp();
$this
->installEntitySchema('node');
$this
->installSchema('user', 'users_data');
$this
->installSchema('node', [
'node_access',
]);
$this
->installConfig(self::$modules);
$this->nodeType = $this
->createContentType([
'type' => 'page',
]);
$this->autoEntityLabelPermissionController = new AutoEntityLabelPermissionController($this->container
->get('entity_type.manager'));
}
public function testAutoEntityLabelPermissions() {
$this
->assertNotEmpty($this->autoEntityLabelPermissionController
->autoEntityLabelPermissions());
$this
->assertEquals([
'administer node_type labels' => [
'title' => '<em class="placeholder">Content type</em>: Administer automatic entity labels',
'restrict access' => TRUE,
],
], $this->autoEntityLabelPermissionController
->autoEntityLabelPermissions());
}
}