Skip to content

Feat: Coding standards and unit tests.#162

Open
mgiannopoulos24 wants to merge 6 commits into
gunet:masterfrom
mgiannopoulos24:feat/coding-standards-and-tests
Open

Feat: Coding standards and unit tests.#162
mgiannopoulos24 wants to merge 6 commits into
gunet:masterfrom
mgiannopoulos24:feat/coding-standards-and-tests

Conversation

@mgiannopoulos24

@mgiannopoulos24 mgiannopoulos24 commented May 26, 2026

Copy link
Copy Markdown
Contributor

Περιγραφή

Το PR προσθέτει:

  • 2 unit test για 2 συναρτήσεις του main_lib.php
  • 3 workflows για code linting, code scanning και phpunit tests. Τα 2 τελευταία workflows σκόπιμα δεν έχουν γίνει με τρόπο ώστε να τρέχουν σε push στο master branch. Επίσης και τα 3 workflows τρέχουν με ένα matrix στις 4 πιο πρόσφατες εκδόσεις της PHP για να διασφαλιστεί η συμβατότητα των αλλαγών.
  • phpcs.xml και phpunit.xml configuration files.

Περισσότεροι κανόνες για τα 2 configuration files:

Σχετικό issue

Issue #140

Τρόπος χρήσης (χειροκίνητα)

  • phpcs:
./vendor/bin/phpcs --standard=phpcs.xml file/dir_of_choice # e.g. index.php
  • phpcbf (code beautifier - fixer)

Σημείωση: Κάποια λάθη δεν είναι αυτόματα fixable.

./vendor/bin/phpcbf --standard=phpcs.xml file/dir_of_choice # e.g. index.php
  • phpunit
./vendor/bin/phpunit

Σημειώσεις

Προς το παρόν τα unit test καλύπτουν μόνο κάποιες συναρτήσεις χωρίς χρήση βάσης. Για να καλυφθούν και συναρτήσεις βάσης θα χρειαστούν αλλαγές.

Μελλοντικές βελτιώσεις

Σε κάποιο επόμενο PR θα προσθέσω E2E tests με Playwright. Κάνουν simulate την συμπεριφορά ενός χρήστη στην ιστοσελίδα. Άλλη μία καλή προσθήκη θα ήταν το PHPStan για static analysis.

@mgiannopoulos24 mgiannopoulos24 marked this pull request as draft May 26, 2026 16:17
@mgiannopoulos24 mgiannopoulos24 marked this pull request as ready for review May 26, 2026 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant