UserBehaviorSettingsFormTest.php in Rabbit Hole 8
File
modules/rh_user/tests/src/Functional/UserBehaviorSettingsFormTest.php
View source
<?php
namespace Drupal\Tests\rh_user\Functional;
use Drupal\Core\Url;
use Drupal\Tests\rabbit_hole\Functional\RabbitHoleBehaviorSettingsFormTestBase;
class UserBehaviorSettingsFormTest extends RabbitHoleBehaviorSettingsFormTestBase {
protected $entityType = 'user';
protected $bundleEntityTypeName = 'user';
public static $modules = [
'rh_user',
'user',
];
protected $adminUser;
protected $behaviorSettingsManager;
const DEFAULT_BUNDLE_ACTION = 'display_page';
const DEFAULT_ACTION = 'bundle_default';
public function testBundleCreation() {
}
protected function createEntityBundle() {
return NULL;
}
protected function createEntityBundleFormSubmit($action, $override) {
$this
->drupalLogin($this->adminUser);
$edit = [
'rh_action' => $action,
'rh_override' => $override,
];
$this
->drupalGet('/admin/config/people/accounts');
$this
->assertRabbitHoleSettings();
$this
->submitForm($edit, 'Save configuration');
return 'user';
}
protected function createEntity($action = NULL) {
$values = [];
if (isset($action)) {
$values['rh_action'] = $action;
}
return $this
->drupalCreateUser([], $this
->randomMachineName(), FALSE, $values)
->id();
}
protected function getCreateEntityUrl() {
return Url::fromRoute('user.admin_create');
}
protected function getEditEntityUrl($id) {
return Url::fromRoute('entity.user.edit_form', [
'user' => $id,
]);
}
protected function getEditBundleUrl($bundle) {
return Url::fromRoute('entity.user.admin_form');
}
protected function getAdminPermissions() {
return [
'administer account settings',
'administer users',
];
}
}