Flourish PHP Unframework
This is an archived copy of the forum for reference purposes

Unit Test Examples

posted by wsgavin 8 years ago

First off, thank you Mr. Bond. Flourish works well for me and have enjoyed using it over the past month.

I was curious if there were some examples of unit testing that could be provided. Actually, it's more than unit testing as I want to "test" GET/POST functions for my project. More of a transitional test. I know I could use Selenium with PHPUnit but I want to run test pre-browser. I thought you might have some examples that could be used as boilerplate. Essentially, I want to test functionality w/o a browser before I test the browser. There may be some other tools I am not aware of but thought the use of PHPUnit would be my first choice. Make sense? Thoughts.

I use PHPUnit for Flourish and I think it is quite capable of the majority of testing requirements. I would recommend it. The only critiques I have is the upgrade process documentation and handling different PHP configurations. I had some trouble figuring out what I needed to do to upgrade my tests from 3.4 to 3.5 recently since I was using some test suite functionality that went away.

While I don't show all of the tests in the Code tab for simplicity, you can browse them at https://github.com/wbond/flourish/tree/master/tests. My setup it probably quite a bit more complicated than what you'll need. I have a custom test runner that runs tests multiple times with different PHP ini settings to ensure I test with non-standard extensions unloaded. I also have a bash script that executes the tests remotely on the 12 different virtual machines.

posted by wbond 8 years ago