You are here

protected function SimplenewsSynchronizeFieldsFormTest::setUp in Simplenews 8.2

Same name and namespace in other branches
  1. 3.x tests/src/Functional/SimplenewsSynchronizeFieldsFormTest.php \Drupal\Tests\simplenews\Functional\SimplenewsSynchronizeFieldsFormTest::setUp()

Overrides SimplenewsTestBase::setUp

File

tests/src/Functional/SimplenewsSynchronizeFieldsFormTest.php, line 32

Class

SimplenewsSynchronizeFieldsFormTest
Tests that shared fields are synchronized when using forms.

Namespace

Drupal\Tests\simplenews\Functional

Code

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

  // Add a field to both entities.
  $this
    ->addField('string', 'field_shared', 'user');
  $this
    ->addField('string', 'field_shared', 'simplenews_subscriber');

  // Create a user.
  $this->user = $this
    ->drupalCreateUser([
    'administer simplenews subscriptions',
    'administer simplenews settings',
  ]);
  $this->user
    ->setEmail('user@example.com');
  $this->user
    ->set('field_shared', $this
    ->randomMachineName());
  $this->user
    ->save();
}