Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cshs
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
cshs
Commits
e539e6e3
Commit
e539e6e3
authored
3 months ago
by
Joseph Olstad
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3455186
by cmlara, joseph.olstad - Replace withConsecutive and willReturnOnConsecutiveCalls.
parent
e5432592
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#322451
failed
3 months ago
Stage: build
Stage: validate
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/src/Unit/CshsGroupByRootFormatterUnitTest.php
+12
-29
12 additions, 29 deletions
tests/src/Unit/CshsGroupByRootFormatterUnitTest.php
with
12 additions
and
29 deletions
tests/src/Unit/CshsGroupByRootFormatterUnitTest.php
+
12
−
29
View file @
e539e6e3
...
...
@@ -45,22 +45,13 @@ class CshsGroupByRootFormatterUnitTest extends UnitTestCase {
'getTranslationFromContext'
,
])
->
getMock
();
foreach
(
\array_keys
(
$settings
)
as
$i
=>
$key
)
{
$mock
->
expects
(
static
::
at
(
$i
))
->
method
(
'getSetting'
)
->
with
(
$key
)
->
willReturn
(
$settings
[
$key
]);
}
$mock
->
expects
(
static
::
exactly
(
\count
(
$settings
)))
->
method
(
'getSetting'
)
->
withConsecutive
(
...
\array_map
(
static
fn
(
string
$name
):
array
=>
[
$name
],
\array_keys
(
$settings
),
)
)
->
willReturnOnConsecutiveCalls
(
...
\array_map
(
static
fn
(
mixed
$value
):
mixed
=>
$value
,
\array_values
(
$settings
),
)
);
$terms
=
\array_map
(
function
(
array
$lineage
):
array
{
static
$created
=
[];
...
...
@@ -110,21 +101,13 @@ class CshsGroupByRootFormatterUnitTest extends UnitTestCase {
->
willReturn
(
$terms_to_view
);
$term_storage
=
$this
->
createMock
(
TermStorageInterface
::
class
);
$term_storage
->
expects
(
static
::
exactly
(
\count
(
$terms_to_view
)
))
foreach
(
$terms_to_view
as
$i
=>
$term
)
{
$term_storage
->
expects
(
static
::
at
(
$i
))
->
method
(
'loadAllParents'
)
->
withConsecutive
(
...
\array_map
(
static
fn
(
TermInterface
$term
):
array
=>
[
$term
->
id
()],
$terms_to_view
,
)
)
->
willReturnOnConsecutiveCalls
(
...
\array_map
(
static
fn
(
array
$lineage
):
array
=>
\array_reverse
(
$lineage
),
\array_values
(
$terms
),
)
);
->
with
(
$term
->
id
())
->
willReturn
(
\array_reverse
(
$terms
[
$i
]));
}
$mock
->
expects
(
static
::
exactly
(
\count
(
$terms_to_view
)))
...
...
This diff is collapsed.
Click to expand it.
Joseph Olstad
@joseph.olstad
mentioned in commit
2bb05fd9
·
3 months ago
mentioned in commit
2bb05fd9
mentioned in commit 2bb05fd9a9cf0609771c27450f622ca128d9f125
Toggle commit list
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