Skip to content
Snippets Groups Projects
Commit 3022c425 authored by Elliot Ward's avatar Elliot Ward Committed by Elliot Ward
Browse files

Issue #3091502 by Eli-T: Module has no tests

parent 7d34393b
No related branches found
No related tags found
No related merge requests found
<?php
namespace Drupal\Tests\jsonapi_reference\Functional;
use Drupal\KernelTests\AssertConfigTrait;
use Drupal\Tests\BrowserTestBase;
/**
* Class JsonApiReferenceTest.
*
* @group jsonapi_reference
*/
class JsonApiReferenceTest extends BrowserTestBase {
use AssertConfigTrait;
/**
* {@inheritdoc}
*/
static protected $modules = ['jsonapi_reference'];
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
}
/**
* Test configuration form protected by permissions.
*
* @throws \Behat\Mink\Exception\ExpectationException
* @throws \Drupal\Core\Entity\EntityStorageException
*/
public function testConfigFormProtected() {
// Test anonymous users can't access the configuration screen.
$this->drupalGet('admin/config/jsonapi_reference');
$this->assertSession()->statusCodeEquals(403);
// Test a logged in user with no specific permissions can't access the
// configuration screen.
$person_of_no_significance = $this->createUser();
$this->drupalLogin($person_of_no_significance);
$this->drupalGet('admin/config/jsonapi_reference');
$this->assertSession()->statusCodeEquals(403);
$this->drupalLogout();
// Test a logged in user with the appropriate permission can access the
// configuration screen.
$person_of_appropriate_significance = $this->createUser(['configure jsonapi reference']);
$this->drupalLogin($person_of_appropriate_significance);
$this->drupalGet('admin/config/jsonapi_reference');
$this->assertSession()->statusCodeEquals(200);
$this->drupalLogout();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment