EntityShareServerFunctionalTestBase.php in Entity Share 8.3
File
modules/entity_share_server/tests/src/Functional/EntityShareServerFunctionalTestBase.php
View source
<?php
declare (strict_types=1);
namespace Drupal\Tests\entity_share_server\Functional;
use Drupal\Core\Session\AccountInterface;
use Drupal\Tests\BrowserTestBase;
use GuzzleHttp\RequestOptions;
abstract class EntityShareServerFunctionalTestBase extends BrowserTestBase {
use EntityShareServerRequestTestTrait;
public static $modules = [
'entity_share_server',
'entity_share_test',
'basic_auth',
];
protected $defaultTheme = 'classy';
protected $adminUser;
protected $channelUser;
protected $entityTypeManager;
protected function setUp() : void {
parent::setUp();
$this->adminUser = $this
->drupalCreateUser($this
->getAdministratorPermissions());
$this->channelUser = $this
->drupalCreateUser($this
->getChannelUserPermissions());
$this->entityTypeManager = $this->container
->get('entity_type.manager');
}
protected function getAdministratorPermissions() {
return [
'view the administration theme',
'access administration pages',
'administer_channel_entity',
];
}
protected function getChannelUserPermissions() {
return [
'entity_share_server_access_channels',
];
}
protected function getAuthenticationRequestOptions(AccountInterface $account) {
return [
RequestOptions::HEADERS => [
'Authorization' => 'Basic ' . base64_encode($account
->getAccountName() . ':' . $account->passRaw),
],
];
}
}