-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ACMS-4373: Add permission test coverage to Tour module.
- Loading branch information
1 parent
b882573
commit 8a65096
Showing
3 changed files
with
63 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
modules/acquia_cms_tour/tests/src/Functional/PermissionsTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Drupal\tests\acquia_cms_tour\Functional; | ||
|
||
use Drupal\Tests\BrowserTestBase; | ||
|
||
/** | ||
* Tests the PermissionManager class. | ||
* | ||
* @group acquia_cms_tour | ||
*/ | ||
class PermissionsTest extends BrowserTestBase { | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected static $modules = [ | ||
'acquia_cms_tour' | ||
]; | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected $defaultTheme = 'stark'; | ||
|
||
/** | ||
* The entity type manager service. | ||
* | ||
* @var \Drupal\Core\Entity\EntityTypeManagerInterface | ||
*/ | ||
protected $entityTypeManager; | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function setUp(): void { | ||
parent::setUp(); | ||
$this->drupalCreateRole([],'content_administrator'); | ||
$this->entityTypeManager = $this->container->get("entity_type.manager"); | ||
} | ||
|
||
/** | ||
* Tests permissions are granted to content_administrator role. | ||
*/ | ||
public function testGrantPermissionsOnInstall(): void { | ||
// Load the role and check its permissions. | ||
$role_permissions = $this->entityTypeManager->getStorage('user_role')->load('content_administrator')->getPermissions(); | ||
$this->assertEquals(['access acquia cms tour dashboard'], $role_permissions); | ||
} | ||
|
||
} |