protected function DeveloperAppPermissionTest::setUp in Apigee Edge 8
Overrides ApigeeEdgeFunctionalTestBase::setUp
File
- tests/
src/ Functional/ DeveloperAppPermissionTest.php, line 123
Class
- DeveloperAppPermissionTest
- Developer app entity permission test.
Namespace
Drupal\Tests\apigee_edge\FunctionalCode
protected function setUp() {
parent::setUp();
$this->entityType = $this->container
->get('entity_type.manager')
->getDefinition('developer_app');
// Skip api key routes. These are tested separately.
$links = array_filter($this->entityType
->get('links'), function ($path) {
return strpos($path, '{consumer_key}') === FALSE;
});
$this->entityRoutes = array_keys($links);
$this
->revokeDefaultAuthUserPermissions();
$this->myAccount = $this
->createAccount([]);
$this->otherAccount = $this
->createAccount([]);
/** @var \Drupal\apigee_edge\Entity\Developer $myDeveloper */
$myDeveloper = Developer::load($this->myAccount
->getEmail());
/** @var \Drupal\apigee_edge\Entity\Developer $otherDeveloper */
$otherDeveloper = Developer::load($this->otherAccount
->getEmail());
$this->myDeveloperApp = DeveloperApp::create([
'name' => $this
->randomMachineName(),
'status' => App::STATUS_APPROVED,
'developerId' => $myDeveloper
->uuid(),
]);
$this->myDeveloperApp
->save();
$this->myDeveloperApp
->setOwner($this->myAccount);
$this->otherDeveloperApp = DeveloperApp::create([
'name' => $this
->randomMachineName(),
'status' => App::STATUS_APPROVED,
'developerId' => $otherDeveloper
->uuid(),
]);
$this->otherDeveloperApp
->save();
$this->otherDeveloperApp
->setOwner($this->otherAccount);
foreach (array_keys(static::PERMISSION_MATRIX) as $permission) {
$this->roles[$permission] = $this
->createRole([
$permission,
]);
}
}