gathering / wannabe

Event-system for TG - wannabe.gathering.org
GNU General Public License v3.0
12 stars 7 forks source link

Add Composer and PHPUnit #5

Closed simenandre closed 4 years ago

simenandre commented 4 years ago

Makes it possible to utilize Composer for package management and PHPUnit for unit testing.

Suggest that #4 before this – Composer works poorly when you have to commit all the packages 😅

KristianLyng commented 4 years ago

Looks interesting to me.

I have to questions:

  1. Does this have any immediate effect or is it just laying the groundwork for future improvements? Specially with regards to deploy.

  2. Could you explain in like 2-4 sentences how we would use it in the future?

simenandre commented 4 years ago

For the first questions, yes. This PR is to lay the groundwork.

Secondly, I'd say it's two parts. It's been many years since I last used Composer, but at the time it was like NPM/pip/Go/NuGet but for PHP (and I believe it still is). With this PR Wannabe can add dependencies actively maintained and updated (also, it will help developers do more efficient work too). The second part is, of course, PHPUnit. PHPUnit is the most known/used testing framework for PHP. I'd like to see Wannabe having a build pipeline that runs unit tests for the application. Unit testing helps make it easier for maintainers to review, and helps developers get more confidence in the software. Most notably, making the software more reliable.

I thought that we initially could add Travis CI, have it run PHPUnit (even without any tests) to report coverage. Hopefully, this could feed some enthusiasm among developers to add tests and see the improvements in coverage. Ultimately, we can add some procedure for testing (if we end up there 🙂).

KristianLyng commented 4 years ago

LGTM , but I'd prefer if one other person agrees since I've been out of PHP for 15+ years. @olemathias or @Ronnrein perhaps one of you have an opionon?

simenandre commented 4 years ago

That sounds very good.

Last I wrote PHP was working on objekt, so it's been a few years as well. Don't take my word on it ;-)

Koch commented 4 years ago

Definitely lays groundwork for having a more manageable vendor-solution in the future, if Wannabe would ever need one. Not sure how much would be plugged in on top of Cake; but it still doesn't hurt to have Composer around for the "what if" situations in the future that may be encountered. As long as we .gitignore the file first (like he mentions in the first comment) before install of phpunit, there should be no issue with this, honestly.

With the addition of phpunit we do get the added extra work of writing tests, but it doesn't hurt to have phpunit around either. Until Composer is actually 100% needed, you simply just don't have to run Composer, and nothing will happen.

I fully support this as someone who has used PHP quite a bit, and recently. Composer is the standard for almost all new PHP projects nowadays, it doesn't hurt to include it in an old project, either.

👍 from me.

KristianLyng commented 4 years ago

The general consensus is as @Koch says (more comments om slack). So I'm merging this in. Thanks!