Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
rabbit_hole
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
rabbit_hole
Commits
dd90589f
Commit
dd90589f
authored
2 years ago
by
Ivan Doroshenko
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3303716
: Settings page - added test coverage for bundles statuses.
parent
fb5f265d
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!68
Issue #3298741: Fix the issues reported by phpcs
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/src/Functional/RabbitHoleSettingsFormTest.php
+32
-5
32 additions, 5 deletions
tests/src/Functional/RabbitHoleSettingsFormTest.php
with
32 additions
and
5 deletions
tests/src/Functional/RabbitHoleSettingsFormTest.php
+
32
−
5
View file @
dd90589f
...
...
@@ -3,6 +3,7 @@
namespace
Drupal\Tests\rabbit_hole\Functional
;
use
Drupal\Tests\BrowserTestBase
;
use
Drupal\Tests\taxonomy\Traits\TaxonomyTestTrait
;
/**
* Test the RabbitHoleSettingsForm form functionality.
...
...
@@ -13,6 +14,8 @@ use Drupal\Tests\BrowserTestBase;
*/
class
RabbitHoleSettingsFormTest
extends
BrowserTestBase
{
use
TaxonomyTestTrait
;
/**
* {@inheritdoc}
*/
...
...
@@ -36,25 +39,49 @@ class RabbitHoleSettingsFormTest extends BrowserTestBase {
$this
->
assertSession
()
->
pageTextContains
(
'There are no supported entity types yet. Please enable one of the submodules.'
);
$this
->
submitForm
([],
'Save configuration'
);
\Drupal
::
service
(
'module_installer'
)
->
install
([
'rh_user'
,
'rh_taxonomy'
]);
\Drupal
::
service
(
'module_installer'
)
->
install
([
'rh_user'
,
'rh_node'
,
'rh_taxonomy'
]);
$this
->
drupalGet
(
'admin/config/content/rabbit-hole'
);
$this
->
assertSession
()
->
fieldExists
(
'entity_types[user]'
);
$this
->
assertSession
()
->
fieldExists
(
'entity_types[node]'
);
$this
->
assertSession
()
->
fieldExists
(
'entity_types[taxonomy_term]'
);
// Make sure unsupported entity types are not available.
$this
->
assertSession
()
->
fieldNotExists
(
'entity_types[
node
]'
);
$this
->
assertSession
()
->
fieldNotExists
(
'entity_types[
media
]'
);
// Verify form submit.
$this
->
submitForm
([
'entity_types[user]'
=>
TRUE
],
'Save configuration'
);
$this
->
submitForm
([
'entity_types[user]'
=>
TRUE
,
'entity_types[taxonomy_term]'
=>
TRUE
,
],
'Save configuration'
);
$this
->
assertSession
()
->
checkboxChecked
(
'entity_types[taxonomy_term]'
);
$this
->
assertSession
()
->
checkboxChecked
(
'entity_types[user]'
);
$this
->
assertSession
()
->
checkboxNotChecked
(
'entity_types[taxonomy_term]'
);
$this
->
assertSession
()
->
checkboxNotChecked
(
'entity_types[node]'
);
// Check operations.
$this
->
assertSession
()
->
elementExists
(
'css'
,
'tr[data-drupal-selector="edit-table-user"] a'
);
$this
->
assertSession
()
->
elementNotExists
(
'css'
,
'tr[data-drupal-selector="edit-table-
taxonomy-term
"] a'
);
$this
->
assertSession
()
->
elementNotExists
(
'css'
,
'tr[data-drupal-selector="edit-table-
node
"] a'
);
// Check entity type settings page.
$this
->
click
(
'tr[data-drupal-selector="edit-table-user"] a'
);
$this
->
assertSession
()
->
fieldExists
(
'bundles[user][rh_action]'
);
$this
->
assertSession
()
->
fieldExists
(
'bundles[user][rh_override]'
);
// Add a couple pf taxonomy vocabularies.
$voc1
=
$this
->
createVocabulary
();
$voc2
=
$this
->
createVocabulary
();
// Make sure that default behavior is applied.
$this
->
drupalGet
(
'admin/config/content/rabbit-hole'
);
$this
->
assertSession
()
->
responseContains
(
'<em class="placeholder">'
.
$voc1
->
label
()
.
'</em> (Behavior: <em class="placeholder">Display the page</em>; Allow overrides: <em class="placeholder">Yes</em>)'
);
$this
->
assertSession
()
->
responseContains
(
'<em class="placeholder">'
.
$voc2
->
label
()
.
'</em> (Behavior: <em class="placeholder">Display the page</em>; Allow overrides: <em class="placeholder">Yes</em>)'
);
$this
->
click
(
'tr[data-drupal-selector="edit-table-taxonomy-term"] a'
);
$this
->
submitForm
([
'bundles['
.
$voc1
->
id
()
.
'][rh_action]'
=>
'page_not_found'
,
'bundles['
.
$voc1
->
id
()
.
'][rh_override]'
=>
FALSE
,
],
'Save configuration'
);
$this
->
assertSession
()
->
responseContains
(
'<em class="placeholder">'
.
$voc1
->
label
()
.
'</em> (Behavior: <em class="placeholder">Page not found</em>; Allow overrides: <em class="placeholder">No</em>)'
);
$this
->
assertSession
()
->
responseContains
(
'<em class="placeholder">'
.
$voc2
->
label
()
.
'</em> (Behavior: <em class="placeholder">Display the page</em>; Allow overrides: <em class="placeholder">Yes</em>)'
);
}
}
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