Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
view_mode_switch
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
view_mode_switch
Merge requests
!24
fix failing tests for Drupal >= 10.2
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
fix failing tests for Drupal >= 10.2
issue/view_mode_switch-3413091:3413091-fix-failing-tests
into
2.x
Overview
0
Commits
5
Pipelines
6
Changes
3
Merged
Tom Keitel
requested to merge
issue/view_mode_switch-3413091:3413091-fix-failing-tests
into
2.x
1 year ago
Overview
0
Commits
5
Pipelines
6
Changes
3
Expand
Closes
#3413091
Edited
1 year ago
by
Tom Keitel
0
0
Merge request reports
Compare
2.x
version 5
90c5d127
1 year ago
version 4
eee9c967
1 year ago
version 3
613d96ff
1 year ago
version 2
e2d0d440
1 year ago
version 1
c7b95be0
1 year ago
2.x (base)
and
latest version
latest version
90c5d127
5 commits,
1 year ago
version 5
90c5d127
5 commits,
1 year ago
version 4
eee9c967
5 commits,
1 year ago
version 3
613d96ff
4 commits,
1 year ago
version 2
e2d0d440
2 commits,
1 year ago
version 1
c7b95be0
1 commit,
1 year ago
3 files
+
151
−
95
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
Search (e.g. *.vue) (Ctrl+P)
tests/src/Functional/ViewModeSwitchFieldUITest.php
+
97
−
46
Options
@@ -97,58 +97,109 @@ class ViewModeSwitchFieldUITest extends ViewModeSwitchTestBase {
}
/**
* Tests the view mode switch field settings form
s
.
* Tests the view mode switch field settings form.
*/
public
function
testFieldSettingsForm
s
():
void
{
public
function
testFieldSettingsForm
():
void
{
$this
->
drupalLogin
(
$this
->
adminUser
);
$assert
=
$this
->
assertSession
();
$type_path
=
'entity_test/structure/entity_test'
;
// Test view mode switch field storage settings form.
$this
->
drupalGet
(
$type_path
.
'/fields/entity_test.entity_test.'
.
$this
->
field
->
getName
()
.
'/storage'
);
// Test that field cardinality is not configurable.
$assert
->
fieldNotExists
(
'cardinality_number'
);
// Test origin view modes.
$assert
->
fieldExists
(
'settings[origin_view_modes][default]'
);
$assert
->
checkboxNotChecked
(
'settings[origin_view_modes][default]'
);
$assert
->
fieldExists
(
'settings[origin_view_modes][full]'
);
$assert
->
checkboxNotChecked
(
'settings[origin_view_modes][full]'
);
$assert
->
fieldExists
(
'settings[origin_view_modes][origin1]'
);
$assert
->
checkboxChecked
(
'settings[origin_view_modes][origin1]'
);
$assert
->
fieldExists
(
'settings[origin_view_modes][origin2]'
);
$assert
->
checkboxNotChecked
(
'settings[origin_view_modes][origin2]'
);
$assert
->
fieldExists
(
'settings[origin_view_modes][switch1]'
);
$assert
->
checkboxNotChecked
(
'settings[origin_view_modes][switch1]'
);
$assert
->
fieldExists
(
'settings[origin_view_modes][switch2]'
);
$assert
->
checkboxNotChecked
(
'settings[origin_view_modes][switch2]'
);
$assert
->
fieldExists
(
'settings[origin_view_modes][switch3]'
);
$assert
->
checkboxNotChecked
(
'settings[origin_view_modes][switch3]'
);
$assert
->
fieldExists
(
'settings[origin_view_modes][switch4]'
);
$assert
->
checkboxNotChecked
(
'settings[origin_view_modes][switch4]'
);
$assert
->
fieldExists
(
'settings[origin_view_modes][test]'
);
$assert
->
checkboxChecked
(
'settings[origin_view_modes][test]'
);
// Test view mode switch field settings form.
$this
->
drupalGet
(
$type_path
.
'/fields/entity_test.entity_test.'
.
$this
->
field
->
getName
());
// Test allowed view modes.
$assert
->
fieldExists
(
'settings[allowed_view_modes][full]'
);
$assert
->
checkboxNotChecked
(
'settings[allowed_view_modes][full]'
);
$assert
->
fieldExists
(
'settings[allowed_view_modes][origin2]'
);
$assert
->
checkboxNotChecked
(
'settings[allowed_view_modes][origin2]'
);
$assert
->
fieldExists
(
'settings[allowed_view_modes][switch1]'
);
$assert
->
checkboxChecked
(
'settings[allowed_view_modes][switch1]'
);
$assert
->
fieldExists
(
'settings[allowed_view_modes][switch2]'
);
$assert
->
checkboxChecked
(
'settings[allowed_view_modes][switch2]'
);
$assert
->
fieldExists
(
'settings[allowed_view_modes][switch3]'
);
$assert
->
checkboxNotChecked
(
'settings[allowed_view_modes][switch3]'
);
$assert
->
fieldExists
(
'settings[allowed_view_modes][switch4]'
);
$assert
->
checkboxNotChecked
(
'settings[allowed_view_modes][switch4]'
);
// Test no allowed view mode options exist for 'default' and configured
// origin view modes.
$assert
->
fieldNotExists
(
'settings[allowed_view_modes][default]'
);
$assert
->
fieldNotExists
(
'settings[allowed_view_modes][origin1]'
);
$assert
->
fieldNotExists
(
'settings[allowed_view_modes][test]'
);
// Tests for Drupal >= 10.2. due to restructured field settings form.
// @see https://www.drupal.org/node/3386675
if
(
version_compare
(
\Drupal
::
VERSION
,
'10.2'
,
'>='
))
{
// Test view mode switch field settings form.
$this
->
drupalGet
(
$type_path
.
'/fields/entity_test.entity_test.'
.
$this
->
field
->
getName
());
// Test that field cardinality is not configurable.
$assert
->
fieldNotExists
(
'cardinality_number'
);
// Test origin view modes.
$assert
->
fieldExists
(
'field_storage[subform][settings][origin_view_modes][default]'
);
$assert
->
checkboxNotChecked
(
'field_storage[subform][settings][origin_view_modes][default]'
);
$assert
->
fieldExists
(
'field_storage[subform][settings][origin_view_modes][full]'
);
$assert
->
checkboxNotChecked
(
'field_storage[subform][settings][origin_view_modes][full]'
);
$assert
->
fieldExists
(
'field_storage[subform][settings][origin_view_modes][origin1]'
);
$assert
->
checkboxChecked
(
'field_storage[subform][settings][origin_view_modes][origin1]'
);
$assert
->
fieldExists
(
'field_storage[subform][settings][origin_view_modes][origin2]'
);
$assert
->
checkboxNotChecked
(
'field_storage[subform][settings][origin_view_modes][origin2]'
);
$assert
->
fieldExists
(
'field_storage[subform][settings][origin_view_modes][switch1]'
);
$assert
->
checkboxNotChecked
(
'field_storage[subform][settings][origin_view_modes][switch1]'
);
$assert
->
fieldExists
(
'field_storage[subform][settings][origin_view_modes][switch2]'
);
$assert
->
checkboxNotChecked
(
'field_storage[subform][settings][origin_view_modes][switch2]'
);
$assert
->
fieldExists
(
'field_storage[subform][settings][origin_view_modes][switch3]'
);
$assert
->
checkboxNotChecked
(
'field_storage[subform][settings][origin_view_modes][switch3]'
);
$assert
->
fieldExists
(
'field_storage[subform][settings][origin_view_modes][switch4]'
);
$assert
->
checkboxNotChecked
(
'field_storage[subform][settings][origin_view_modes][switch4]'
);
$assert
->
fieldExists
(
'field_storage[subform][settings][origin_view_modes][test]'
);
$assert
->
checkboxChecked
(
'field_storage[subform][settings][origin_view_modes][test]'
);
// Test allowed view modes.
$assert
->
fieldExists
(
'settings[allowed_view_modes][full]'
);
$assert
->
checkboxNotChecked
(
'settings[allowed_view_modes][full]'
);
$assert
->
fieldExists
(
'settings[allowed_view_modes][origin2]'
);
$assert
->
checkboxNotChecked
(
'settings[allowed_view_modes][origin2]'
);
$assert
->
fieldExists
(
'settings[allowed_view_modes][switch1]'
);
$assert
->
checkboxChecked
(
'settings[allowed_view_modes][switch1]'
);
$assert
->
fieldExists
(
'settings[allowed_view_modes][switch2]'
);
$assert
->
checkboxChecked
(
'settings[allowed_view_modes][switch2]'
);
$assert
->
fieldExists
(
'settings[allowed_view_modes][switch3]'
);
$assert
->
checkboxNotChecked
(
'settings[allowed_view_modes][switch3]'
);
$assert
->
fieldExists
(
'settings[allowed_view_modes][switch4]'
);
$assert
->
checkboxNotChecked
(
'settings[allowed_view_modes][switch4]'
);
// Test no allowed view mode options exist for 'default' and configured
// origin view modes.
$assert
->
fieldNotExists
(
'settings[allowed_view_modes][default]'
);
$assert
->
fieldNotExists
(
'settings[allowed_view_modes][origin1]'
);
$assert
->
fieldNotExists
(
'settings[allowed_view_modes][test]'
);
}
// @todo Remove tests for Drupal < 10.2 when module requires Drupal >= 10.2.
// Tests for Drupal < 10.2.
else
{
// Test view mode switch field storage settings form.
$this
->
drupalGet
(
$type_path
.
'/fields/entity_test.entity_test.'
.
$this
->
field
->
getName
()
.
'/storage'
);
// Test that field cardinality is not configurable.
$assert
->
fieldNotExists
(
'cardinality_number'
);
// Test origin view modes.
$assert
->
fieldExists
(
'settings[origin_view_modes][default]'
);
$assert
->
checkboxNotChecked
(
'settings[origin_view_modes][default]'
);
$assert
->
fieldExists
(
'settings[origin_view_modes][full]'
);
$assert
->
checkboxNotChecked
(
'settings[origin_view_modes][full]'
);
$assert
->
fieldExists
(
'settings[origin_view_modes][origin1]'
);
$assert
->
checkboxChecked
(
'settings[origin_view_modes][origin1]'
);
$assert
->
fieldExists
(
'settings[origin_view_modes][origin2]'
);
$assert
->
checkboxNotChecked
(
'settings[origin_view_modes][origin2]'
);
$assert
->
fieldExists
(
'settings[origin_view_modes][switch1]'
);
$assert
->
checkboxNotChecked
(
'settings[origin_view_modes][switch1]'
);
$assert
->
fieldExists
(
'settings[origin_view_modes][switch2]'
);
$assert
->
checkboxNotChecked
(
'settings[origin_view_modes][switch2]'
);
$assert
->
fieldExists
(
'settings[origin_view_modes][switch3]'
);
$assert
->
checkboxNotChecked
(
'settings[origin_view_modes][switch3]'
);
$assert
->
fieldExists
(
'settings[origin_view_modes][switch4]'
);
$assert
->
checkboxNotChecked
(
'settings[origin_view_modes][switch4]'
);
$assert
->
fieldExists
(
'settings[origin_view_modes][test]'
);
$assert
->
checkboxChecked
(
'settings[origin_view_modes][test]'
);
// Test view mode switch field settings form.
$this
->
drupalGet
(
$type_path
.
'/fields/entity_test.entity_test.'
.
$this
->
field
->
getName
());
// Test allowed view modes.
$assert
->
fieldExists
(
'settings[allowed_view_modes][full]'
);
$assert
->
checkboxNotChecked
(
'settings[allowed_view_modes][full]'
);
$assert
->
fieldExists
(
'settings[allowed_view_modes][origin2]'
);
$assert
->
checkboxNotChecked
(
'settings[allowed_view_modes][origin2]'
);
$assert
->
fieldExists
(
'settings[allowed_view_modes][switch1]'
);
$assert
->
checkboxChecked
(
'settings[allowed_view_modes][switch1]'
);
$assert
->
fieldExists
(
'settings[allowed_view_modes][switch2]'
);
$assert
->
checkboxChecked
(
'settings[allowed_view_modes][switch2]'
);
$assert
->
fieldExists
(
'settings[allowed_view_modes][switch3]'
);
$assert
->
checkboxNotChecked
(
'settings[allowed_view_modes][switch3]'
);
$assert
->
fieldExists
(
'settings[allowed_view_modes][switch4]'
);
$assert
->
checkboxNotChecked
(
'settings[allowed_view_modes][switch4]'
);
// Test no allowed view mode options exist for 'default' and configured
// origin view modes.
$assert
->
fieldNotExists
(
'settings[allowed_view_modes][default]'
);
$assert
->
fieldNotExists
(
'settings[allowed_view_modes][origin1]'
);
$assert
->
fieldNotExists
(
'settings[allowed_view_modes][test]'
);
}
}
/**
Loading