Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Initial Unit Tests and Update Composer Dependencies #370

Merged
merged 16 commits into from
Jul 5, 2024

Conversation

anktd
Copy link
Collaborator

@anktd anktd commented Apr 5, 2024

This is phase 1 of testing for blockonomics woocommerce plugin.
It contains unittests for functions that are independent of WordPress or Woocommerce functionality, focusing on the php/Blockonomics.php file as it contains most of the plugin's functionality.

Instructions for Running Tests:

  • Pull changes to your local machine
  • Navigate to the project directory where the composer.json file is located
  • Run composer install to install the required dependencies. This step requires Composer to be installed on your machine.
    • If you don't have Composer installed, you can download it here.
  • Once the dependencies are installed, you can run the tests using the following command: vendor/bin/phpunit tests/

Note: The vendor directory is included in the .gitignore file and therefore are not committed to the repository. The composer install command will create the vendor directory and ensure you have the correct versions of the dependencies for running the tests.

@shivaenigma shivaenigma requested review from ashthecoder05 and removed request for DarrenWestwood April 23, 2024 05:43
Copy link
Collaborator

@ashthecoder05 ashthecoder05 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Ran it locally and works as expected.

image

@anktd anktd requested a review from DarrenWestwood July 1, 2024 11:46
Copy link
Collaborator

@DarrenWestwood DarrenWestwood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Tests run successfully on my end. I Induced some errors in the code which correctly lead to failures. The included tests are a great start, and more tests can be added as we continue development. Current functions covered in the tests include:

  • calculate_total_paid_fiat
  • fix_displaying_small_values
  • get_crypto_payment_uri
  • getSupportedCurrencies
  • set_headers
  • getActiveCurrencies
  • testSetup
    -- Different setups and errors
    -- update_callback
    -- examine_server_callback_urls
    -- check_callback_urls_or_set_one

Github workflow works as desired.

@DarrenWestwood
Copy link
Collaborator

Merging the Test Setup tests. We can open a new PR for more tests.

@DarrenWestwood DarrenWestwood merged commit 9723644 into blockonomics:master Jul 5, 2024
1 check passed
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.

3 participants