You are here

protected function UserRoleTest::setUp in Feeds 8.3

Same name in this branch
  1. 8.3 tests/src/Unit/Feeds/Target/UserRoleTest.php \Drupal\Tests\feeds\Unit\Feeds\Target\UserRoleTest::setUp()
  2. 8.3 tests/src/Kernel/Feeds/Target/UserRoleTest.php \Drupal\Tests\feeds\Kernel\Feeds\Target\UserRoleTest::setUp()

Overrides FeedsKernelTestBase::setUp

File

tests/src/Kernel/Feeds/Target/UserRoleTest.php, line 49

Class

UserRoleTest
@coversDefaultClass \Drupal\feeds\Feeds\Target\UserRole @group feeds

Namespace

Drupal\Tests\feeds\Kernel\Feeds\Target

Code

protected function setUp() {
  parent::setUp();
  $this
    ->installEntitySchema('user');

  // Create feed type.
  $this->feedType = $this
    ->createFeedTypeForCsv([
    'name' => 'name',
    'mail' => 'mail',
    'role_ids' => 'role_ids',
    'role_labels' => 'role_labels',
  ], [
    'id' => 'user_import',
    'processor' => 'entity:user',
    'processor_configuration' => [
      'update_existing' => ProcessorInterface::UPDATE_EXISTING,
      'authorize' => FALSE,
    ],
    'mappings' => [
      [
        'target' => 'name',
        'map' => [
          'value' => 'name',
        ],
      ],
      [
        'target' => 'mail',
        'map' => [
          'value' => 'mail',
        ],
        'unique' => [
          'value' => TRUE,
        ],
      ],
    ],
  ]);
  $this->userStorage = $this->container
    ->get('entity_type.manager')
    ->getStorage('user');
  $this->roleStorage = $this->container
    ->get('entity_type.manager')
    ->getStorage('user_role');
}