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
Merge requests
!14
Issue
#3303716
: Added a test coverage for bundles status.
Code
Review changes
Check out branch
Download
Patches
Plain diff
Closed
Issue
#3303716
: Added a test coverage for bundles status.
issue/rabbit_hole-3303716:3303716-settings-form-bundles-info
into
2.0.x
Overview
0
Commits
3
Pipelines
0
Changes
1
Closed
Ivan Doroshenko
requested to merge
issue/rabbit_hole-3303716:3303716-settings-form-bundles-info
into
2.0.x
2 years ago
Overview
0
Commits
3
Pipelines
0
Changes
1
Expand
Closes
#3303716
Edited
2 years ago
by
Ivan Doroshenko
0
0
Merge request reports
Compare
2.0.x
version 2
764d36e1
2 years ago
version 1
fefd62c5
2 years ago
2.0.x (base)
and
latest version
latest version
764d36e1
3 commits,
2 years ago
version 2
764d36e1
3 commits,
2 years ago
version 1
fefd62c5
3 commits,
2 years ago
1 file
+
32
−
5
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
tests/src/Functional/RabbitHoleSettingsFormTest.php
+
32
−
5
Options
@@ -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>)'
);
}
}
Loading