Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
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
drupal
Merge requests
!4806
Issue
#3386682
: [random test failure] MenuUiTest::testMenuAdministration
Code
Review changes
Check out branch
Download
Patches
Plain diff
Closed
Issue
#3386682
: [random test failure] MenuUiTest::testMenuAdministration
issue/drupal-3386682:3386682-random-test-failure
into
11.x
Overview
0
Commits
1
Pipelines
1
Changes
1
Closed
spokje
requested to merge
issue/drupal-3386682:3386682-random-test-failure
into
11.x
1 year ago
Overview
0
Commits
1
Pipelines
1
Changes
1
Expand
0
0
Merge request reports
Compare
11.x
version 1
34a952e1
1 year ago
11.x (base)
and
latest version
latest version
8a8f3e6c
1 commit,
1 year ago
version 1
34a952e1
1 commit,
1 year ago
1 file
+
27
−
17
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
core/modules/menu_ui/tests/src/Functional/MenuUiTest.php
+
27
−
17
Options
@@ -186,30 +186,40 @@ public function testMenuAdministration() {
}
// Test alphabetical order without pager.
$menus
=
[];
$menu
_entitie
s
=
[];
for
(
$i
=
1
;
$i
<
6
;
$i
++
)
{
$menus
[]
=
strtolower
(
$this
->
getRandomGenerator
()
->
name
());
}
sort
(
$menus
);
foreach
(
$menus
as
$menu
)
{
Menu
::
create
([
'id'
=>
$menu
,
'label'
=>
$menu
])
->
save
();
$menu
=
strtolower
(
$this
->
getRandomGenerator
()
->
name
());
$menu_entity
=
Menu
::
create
([
'id'
=>
$menu
,
'label'
=>
$menu
]);
$menu_entities
[]
=
$menu_entity
;
$menu_entity
->
save
();
}
uasort
(
$menu_entities
,
[
Menu
::
class
,
'sort'
]);
$menu_entities
=
array_values
(
$menu_entities
);
$this
->
drupalGet
(
'/admin/structure/menu'
);
$base_path
=
parse_url
(
$this
->
baseUrl
,
PHP_URL_PATH
)
??
''
;
$first_link
=
$this
->
assertSession
()
->
elementExists
(
'css'
,
'tbody tr:nth-of-type(1) a'
);
$last_link
=
$this
->
assertSession
()
->
elementExists
(
'css'
,
'tbody tr:nth-of-type(5) a'
);
$this
->
assertEquals
(
$first_link
->
getAttribute
(
'href'
),
sprintf
(
'%s/admin/structure/menu/manage/%s'
,
$base_path
,
$menus
[
0
]));
$this
->
assertEquals
(
$last_link
->
getAttribute
(
'href'
),
sprintf
(
'%s/admin/structure/menu/manage/%s'
,
$base_path
,
$menus
[
4
]));
$this
->
assertEquals
(
$first_link
->
getAttribute
(
'href'
),
sprintf
(
'%s/admin/structure/menu/manage/%s'
,
$base_path
,
$menu_entities
[
0
]
->
label
()));
$this
->
assertEquals
(
$last_link
->
getAttribute
(
'href'
),
sprintf
(
'%s/admin/structure/menu/manage/%s'
,
$base_path
,
$menu_entities
[
4
]
->
label
()));
// Test alphabetical order with pager.
$new_menus
=
[];
$new_menu
_entitie
s
=
[];
for
(
$i
=
1
;
$i
<
61
;
$i
++
)
{
$new_menu
s
[]
=
strtolower
(
$this
->
getRandomGenerator
()
->
name
());
}
foreach
(
$new_menus
as
$menu
)
{
Menu
::
create
([
'id'
=>
$menu
,
'label'
=>
$menu
])
->
save
();
$new_menu
=
strtolower
(
$this
->
getRandomGenerator
()
->
name
());
$new_menu_entity
=
Menu
::
create
([
'id'
=>
$new_menu
,
'label'
=>
$new_menu
]);
$new_menu_entities
[]
=
$new_menu_entity
;
$new_menu_entity
->
save
();
}
$menus
=
array_merge
(
$menus
,
$new_menus
);
sort
(
$menus
);
$menu_entities
=
array_merge
(
$menu_entities
,
$new_menu_entities
);
// To accommodate the current non-natural sorting of the pager, we have to
// first non-natural sort the array of menu entities, and then do a
// natural-sort on the ones that are on page 1.
sort
(
$menu_entities
);
$menu_entities_page_one
=
array_slice
(
$menu_entities
,
50
,
64
,
TRUE
);
uasort
(
$menu_entities_page_one
,
[
Menu
::
class
,
'sort'
]);
$menu_entities_page_one
=
array_values
(
$menu_entities_page_one
);
$this
->
drupalGet
(
'/admin/structure/menu'
,
[
'query'
=>
[
'page'
=>
1
,
@@ -217,8 +227,8 @@ public function testMenuAdministration() {
]);
$first_link
=
$this
->
assertSession
()
->
elementExists
(
'css'
,
'tbody tr:nth-of-type(1) a'
);
$last_link
=
$this
->
assertSession
()
->
elementExists
(
'css'
,
'tbody tr:nth-of-type(15) a'
);
$this
->
assertEquals
(
$first_link
->
getAttribute
(
'href'
),
sprintf
(
'%s/admin/structure/menu/manage/%s'
,
$base_path
,
$menu
s
[
50
]
));
$this
->
assertEquals
(
$last_link
->
getAttribute
(
'href'
),
sprintf
(
'%s/admin/structure/menu/manage/%s'
,
$base_path
,
$menu
s
[
64
]
));
$this
->
assertEquals
(
$first_link
->
getAttribute
(
'href'
),
sprintf
(
'%s/admin/structure/menu/manage/%s'
,
$base_path
,
$menu
_entities_page_one
[
0
]
->
label
()
));
$this
->
assertEquals
(
$last_link
->
getAttribute
(
'href'
),
sprintf
(
'%s/admin/structure/menu/manage/%s'
,
$base_path
,
$menu
_entities_page_one
[
14
]
->
label
()
));
}
/**
Loading