You are here

public function ImportAccessTest::testImportForm in Bibliography & Citation 2.0.x

Same name and namespace in other branches
  1. 8 modules/bibcite_import/tests/src/Functional/ImportAccessTest.php \Drupal\Tests\bibcite_import\Functional\ImportAccessTest::testImportForm()

Test Import form.

File

modules/bibcite_import/tests/src/Functional/ImportAccessTest.php, line 53

Class

ImportAccessTest
Test access to import form.

Namespace

Drupal\Tests\bibcite_import\Functional

Code

public function testImportForm() {
  $this
    ->drupalLogin($this->user);
  $this
    ->drupalGet('admin/content/bibcite/reference/import');
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $simple_user = $this
    ->drupalCreateUser([
    'create bibcite_reference',
    'edit own bibcite_reference',
    'edit any bibcite_reference',
    'view bibcite_reference',
  ]);
  $this
    ->drupalLogin($simple_user);
  $this
    ->drupalGet('admin/content/bibcite/reference/import');
  $this
    ->assertSession()
    ->statusCodeEquals(403);
  $user_import = $this
    ->drupalCreateUser([
    'create bibcite_reference',
    'edit own bibcite_reference',
    'edit any bibcite_reference',
    'view bibcite_reference',
    'bibcite import',
  ]);
  $this
    ->drupalLogin($user_import);
  $this
    ->drupalGet('admin/content/bibcite/reference/import');
  $this
    ->assertSession()
    ->statusCodeEquals(200);
}