PHP Client of Utopian API - add composer and fix unit tests

in #utopian-io6 years ago (edited)

php1.png

Bug Fixes

  • 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.


php2.png

New Features

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

Proof of work

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



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

Thank you for the contribution. It has been approved.

You can contact us on Discord.
[utopian-moderator]

Hey @howo, I just gave you a tip for your hard work on moderation. Upvote this comment to support the utopian moderators and increase your future rewards!

I've mostly been a PHP developer, but I've been doing everything with NodeJS here on Steem. I will try to give the PHP side a go if I get the energy.

Thank you freinds

Sorry friends, I have not understood the mechanism, ranging from create an account, transactions and excellence like what. thanks for the information.

Hey @helo I am @utopian-io. I have just upvoted you!

Achievements

  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • Seems like you contribute quite often. AMAZING!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x

Its good contribution. Thanks for sharing the post.

Lakukan hal yang sama buat saya kawan..