Feature/unit tests#79
Conversation
|
@Subhanaliweb will include these changes in his upcoming PR with a full test suite. |
- Add PHP unit tests for all classes (212 tests) * Constants, Submission, Settings, Workflow, Frontend, Migration * CodecheckPlugin with comprehensive hook testing * 185 tests pass locally, 27 skipped (require full OJS environment) - Add Cypress component tests (51 tests - all passing) * CodecheckManifestFiles (6 tests) * CodecheckMetadataForm (20 tests) * CodecheckRepositoryList (6 tests) * CodecheckReviewDisplay (7 tests) * CodecheckCertificateIdentifier (6 tests) * CodecheckDataAndSoftwareAvailability (6 tests) - Add test infrastructure * PHPUnit: bootstrap.php, PKPTestCase.php, phpunit.xml * Cypress: cypress.config.js, pkp-mock.js, component support files * GitHub Actions workflow for automated component testing - Update README with testing documentation * Local testing instructions * Docker/CI testing instructions * Component testing commands Total: 263 tests (212 PHP + 51 component)
|
As discussed, I pulled this branch and applied my testing on top of the commits he made. |
@Subhanaliweb Can you briefly confirm: 1. we can close this PR unmerged. 2. You will open a new PR with your combined test suites. |
|
I have appleid my commits of all other testing on this branch so we can merge this one, my other branches will no longer be needed. |
|
Thanks for the clarification @Subhanaliweb. @dxL1nus @Subhanaliweb Please explain why this PR is still a "Draft". Who is best suited to resolve the merge conflicts? |
this needs to stay a draft for now as well. I have to dicuss with Subhan what to do with the methods from the |
|
@nuest See here for the full instructions on how to run tests. |
nuest
left a comment
There was a problem hiding this comment.
Primary change: remove the erroneously committed cache files, ideally also from the history.
Other changes: new extensive test patterns that I do not understand the benefit of; these can stay if it allows us to move on, but I would appreciate the help to understand the reasoning.
|
@Subhanaliweb Please take a look at the unresolved comments above - they are related to test classes you created. Thanks! |
- Removed ConstantsUnitTest.php (testing constants is not behavioral) - Removed SchemaUnitTest.php (schema tested by DAO tests) - Removed CodecheckSchemaMigrationUnitTest.php (migration meta-test)
- Removed meta-tests (method existence, constants, return types) - Kept only tests that verify actual behavior and logic - Fixed assertion issues in DAO tests
- Use CSS class selectors instead of placeholder text - Makes tests independent of translation mock
- Cypress doesn't support Vite 8 yet - Vite 5.4.0 is the latest compatible version
- Runs PHPUnit tests with full OJS environment (stable-3_5_0) - Runs Cypress component tests in parallel - Generates code coverage reports with Xdebug - Uploads artifacts (coverage, logs, screenshots) - Uses GitHub secrets for API credentials - Replaces old component-tests.yml with unified workflow - Tests run on push to main and pull requests
Closes: #36, closes: #74, closes: #75, closes: #76, closes: #77; :warning: This PR needs to be merged after #63 and #79⚠️ This feature let's users import CODECHECK metadata from an already existing `codecheck.yml` file in a codecheck repository, that is located on one of the following platforms with the example repository links: - `GitHub`: https://github.com/codecheckers/certificate-2025-029 - `Zenodo`: https://zenodo.org/records/14900193 - `OSF`: https://osf.io/ymc3t - `GitLab`: https://gitlab.com/cdchck/community-codechecks/2022-svaRetro-svaNUMT To import metadata, simply paste the link to the repository root folder and press `Load Metadata`. <img width="2108" height="175" alt="Image" src="https://github.com/user-attachments/assets/6de1f7f9-d0dc-4e0d-b114-ca2f806ecc14" /> When pressing the Info Button ℹ️ next to the Repositories Title, the user gets presented with a promt, that describes, how the Repository Functionality works along with the link to the documentation of the CODECHECK Register where all Repository Types are described again in more detail. <img width="698" height="579" alt="Image" src="https://github.com/user-attachments/assets/34b1b419-0ce9-4161-99f0-f7e9e6a1198e" />
closes #70
closes #40
closes #73
closes codecheckers/check-pub#35
closes #96
!IMPORTANT: This PR can only be safely merged after PR #63
This is the PR for the first unit tests for the ojs-codecheck plugin. The tests are mainly for the RetrieveReserveIdentifiers scripts and can act as a guideline/ template on how to write other unit tests for the remaining class files.
Run the tests with the following command from the PKP OJS root directory:
Results:

find the test coverage in the following file: