You are here

protected function AgreementMultipleRoleTest::setUp in Agreement 8.2

Same name and namespace in other branches
  1. 3.0.x tests/src/Functional/AgreementMultipleRoleTest.php \Drupal\Tests\agreement\Functional\AgreementMultipleRoleTest::setUp()

Overrides AgreementTestBase::setUp

File

tests/src/Functional/AgreementMultipleRoleTest.php, line 29

Class

AgreementMultipleRoleTest
Tests agreement that applies to multiple roles.

Namespace

Drupal\Tests\agreement\Functional

Code

protected function setUp() {
  parent::setUp();

  // Create the roles.
  $this->requiredRole = $this
    ->createRole([
    'access content',
  ]);
  $this->requiredSecondRole = $this
    ->createRole([
    'access content',
    'create page content',
  ]);

  // Set the agreement to use the roles from the two required users.
  $settings = $this->agreement
    ->getSettings();
  $settings['roles'] = [
    $this->requiredRole,
    $this->requiredSecondRole,
  ];
  $this->agreement
    ->set('settings', $settings);
  $this->agreement
    ->save();
  $this
    ->assertEquals($settings['roles'], $this->agreement
    ->getSettings()['roles']);
}