PermissionsTest.php in Mass Contact 8
File
tests/src/Kernel/PermissionsTest.php
View source
<?php
namespace Drupal\Tests\mass_contact\Kernel;
use Drupal\mass_contact\Permissions;
class PermissionsTest extends MassContactTestBase {
use CategoryCreationTrait;
public function testPermissions() {
$permissions = new Permissions();
$this
->assertEmpty($permissions
->categoryPermissions());
$categories = [];
foreach (range(1, 4) as $i) {
$categories[$i] = $this
->createCategory();
}
$permissions = $permissions
->categoryPermissions();
$this
->assertEquals(4, count($permissions));
$machine_names = array_keys($permissions);
foreach ($categories as $category) {
$permission = array_shift($machine_names);
$this
->assertEquals("mass contact send to users in the {$category->id()} category", $permission);
}
}
}