Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
jsonapi_reference
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
jsonapi_reference
Commits
3022c425
Commit
3022c425
authored
5 years ago
by
Elliot Ward
Committed by
Elliot Ward
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3091502
by Eli-T: Module has no tests
parent
7d34393b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/src/Functional/JsonApiReferenceTest.php
+59
-0
59 additions, 0 deletions
tests/src/Functional/JsonApiReferenceTest.php
with
59 additions
and
0 deletions
tests/src/Functional/JsonApiReferenceTest.php
0 → 100644
+
59
−
0
View file @
3022c425
<?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
();
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment