Fixes and unit tests for UI language detection#1457
Merged
Conversation
Also fixed the language tags in the sample `skosmos:languages` config
… GET, POST, SERVER vars)
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #1457 +/- ##
============================================
+ Coverage 69.57% 70.03% +0.46%
- Complexity 1651 1656 +5
============================================
Files 32 32
Lines 4259 4268 +9
============================================
+ Hits 2963 2989 +26
+ Misses 1296 1279 -17
☔ View full report in Codecov by Sentry. |
|
Kudos, SonarCloud Quality Gate passed!
|
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.








Reasons for creating this PR
@namedgraph reported in #1453 that there are problems with the UI language detection. The main problems were fixed in PR #1455, also by @namedgraph.
The WebController.guessLanguage method which is the core of language detection did not have unit tests, and as it was written, it was difficult to unit test it because it accesses cookies and HTTP header values directly.
This PR makes some changes to WebController.guessLanguage that make it easier to test, adds some basic unit tests that verify the main language detection cases, and then applies the fixes from #1455 on top.
Link to relevant issue(s), if any
Description of the changes in this PR
willdurand/negotiationfrom 3.0.* to 3.1.* because only 3.1 is compatible with PHP 8.1in_array(from PR UI language negotiation fix #1455)skosmos:languagessettings in the sample configs for Docker (from PR UI language negotiation fix #1455)Known problems or uncertainties in this PR
The same fixes need to be applied to the
skosmos-3branch as well. I will do that in a follow-up PR.Checklist
.sr-onlyclass, color contrast)