Skip to content

[PHPUnit] | GitHub Action tests are missing locale keys and passing for wrong reasons #11583

@Tribunal33

Description

@Tribunal33

Description:

  • Include specific context details that have been discovered that surround this developer task.
  • Link related tickets

I'm not well versed in PHP so this might not be an issue but I've noticed that the GitHub Actions runs are showing missing locale keys for Validator tests. I think the reason is that it passes is because it is asserting false but I don't think it is failing for the right reasons. Could we take a look at these validator AssertFalse tests so they aren't throwing so many missing keys.

GitHub Actions
Image

Sample code where they are being tested in the PHPunit Tests

Image

Steps to test the changes:

  1. Run the phpunit tests and it should pass validator tests with correct validation rule.

Solution: What the proposed solutions are and additional affected areas
Either we can remove these validator checks or we can add a rule so that it passes without missing locale keys. I gave a reason for what is happening. I'm not sure if this is expected but when going through these logs it seems like the test isn't doing what it should be doing.

What application are you using?
OJS 3.5 and main but GitHub Actions all PHPunit test runs.

Additional information
Please add any screenshots, videos or other information we can use to understand this dev task report.

After parsing the key with the rule it returns with a key that isn't available so it concatenates to an unknown gibberish key like "validation.values.value.anything else". This will return false because of a missing key and still assert true because the test is expected to fail. I am not sure if the intent of this isValid method is correctly being asserted by this test

PRs

Stable-3.5.0

ojs --> pkp/ojs#4966
ops --> pkp/ops#1043
omp --> pkp/omp#2056
pkp-lib --> #11597
ojs --> pkp/ojs#4978 [TEST ONLY]
omp --> pkp/omp#2075 [TEST ONLY]
ops --> pkp/ops#1062 [TEST ONLY]

main

pkp-lib --> #12016
ojs --> pkp/ojs#5174
omp --> pkp/omp#2186
ops --> pkp/ops#1154
staticPages --> pkp/staticPages#89
webFeed --> pkp/webFeed#16
googleScholar --> pkp/googleScholar#33
customBlockManager --> pkp/customBlockManager#92
googleAnalytics --> pkp/googleAnalytics#62
tinymce --> pkp/tinymce#97
browse --> pkp/browse#15
crossref-ojs --> pkp/crossref-ojs#78
crossref-ops --> pkp/crossref-ops#57

PR Impacts [main (upcoming 3.6)]:

What has changed

  • const PKP_STRICT_MODE has been removed
  • The class_alias is removed so form now on need to use fully qualified namespace for classes
  • Unit test will always run in strict mode backed by specific const PKP_PHPUNIT_STRICT_MODE in phpunit-bootstrap.php
  • Deprecated instantiate has been removed.
  • PluginRegistry::deprecatedInstantiatePlugin has been removed so plugin instantiation using deprecated approach will not work
  • Locale missing log will be only available when the app running in strict mode
  • All the dot notation class paths (e.g. classes::classes.submission.Submission) specifically related to filters has been updated with proper namespace path

For Plugin development

  • Plugin should follow the proper namespace path
  • Plugins not following proper namespace path will need to have wrapper index.php in the plugin path
  • Plugin not following proper namespace and not having a wrapper index.php will be failed to initialize

NOTE : require to run the migration PKP\migration\upgrade\v3_6_0\I11583_ClassNamespaceFromDotNotationClassPath as

php lib/pkp/tools/migration.php "PKP\\migration\\upgrade\\v3_6_0\\I11583_ClassNamespaceFromDotNotationClassPath" up

Metadata

Metadata

Assignees

Labels

Housekeeping:1:TodoAny dependency management or refactor that would be nice to have some day.

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions