// both formats, but the second user only has access to the second one.
$admin_user =
$this->
drupalCreateUser(['administer filters'
]);
$this->
drupalLogin($admin_user);
$formats =
[];
for ($i = 0;
$i < 2;
$i++
) { $edit =
[ 'format' =>
mb_strtolower($this->
randomMachineName()),
'name' =>
$this->
randomMachineName(),
];
$this->
drupalGet('admin/config/content/formats/add'
);
$this->
submitForm($edit, 'Save configuration'
);
$this->
resetFilterCaches();
$formats[] = FilterFormat::
load($edit['format'
]);
} [$first_format,
$second_format] =
$formats;
$second_format_permission =
$second_format->
getPermissionName();
$first_user =
$this->
drupalCreateUser([ $first_format->
getPermissionName(),
$second_format_permission,
]);
$second_user =
$this->
drupalCreateUser([$second_format_permission]);
// Adjust the weights so that the first and second formats (in that order)