What was the issue(s)?
1- The Utopian class was getting required more than once when running all tests.
2- The object total_paid_rewards was missing sometimes from the json results of the api.
3- Function assertEquals was misspelled assertEqual.
What was the solution?
1- Change to require_once: require_once('class.utopian.php');
2- Add logic to check if the object has that property before trying to use it.
3- Correct the function spelling of assertEquals.
I created the composer.json and .lock file to make it easy for anyone using this repo to get the packages required to at least be able to run the unit tests. The .gitignore file will keep the project tidy and the git status clean.
Install composer if you don't already have it:
sudo apt-get install composer
Once in the repo's directory, do:
composer install
This will install the phpunit test suite.
You can then test all tests using this command:
vendor/phpunit/phpunit/phpunit tests
Or if you want to test one at a time, do this:
vendor/phpunit/phpunit/phpunit UnitTest tests/sponsors_Test.php
This is the Pull Request for my contribution. My steem username is in my github profile bio, under my name and picture.
This is the post that motivated me to make this PR.
Congratulation to @justyy for bringing the Utopian API to PHP.
Long live PHP, Steem and Utopian.io