Hey guys!

I love how I can do smth like "php index.php mycontroller myfunction" from unix command line and test my controller.

However, I cannot figure out how (if) it's possible to pass parameters that would be accessible through "$this->input->post('key')"

The idea is to have a web app that would run both on the web server and from CLI using the same code. That would allow creating extensive unit tests and improve test automation significantly.

Another options is to stop using $this->input->post() and switch to something that's supported from both command line and web.

I think the ideal solution would be if "$this->input->post()" read some command line parameter behind the scenes if the app was running in command line interface.


If it runs on the server then $this->input->post() acts normally as it does now

If it runs from CLI, and say the command was:

php index.php mycontroller myhandler -POST var1=x var2=y var3=z

Then $this->input->post() would be smart enough to detect the environment and be able to return var1, var2, var3 values.

What would you recommend? How do I test my application through CLI? Thanks!

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.