Wednesday, 15 January 2014

php - CodeIgniter CLI - passing multiple args to method -


I'm testing some models with a code ignition project via CLI, there are two arguments in this question:

  public function get_questions_from_block ($ block_name, $ return_array = FALSE)   

I have tried this:

  php index Php test_controller get_question_block_name example_block TRUE   

but it returns 0 or FALSE. How do I overcome many arguments through CLI? Do I have to use it:

  $ _ server ['argv'];   

To get all the arguments? Or is there any easy way?

You can $ _ SERVER ['argv'] < P> But in this case, I do not think it will help you (without heavy code modification).

Perhaps you should see that CI provides.

In that, you can easily do many tests against your model by doing something like the following in a separate unit test file:

  $ this-> load - & gt; Model ('test_model'); $ This- & gt; Unit- & gt; Run ($ this-> test_model- & gt; get_questions_from_block (args), $ expected_bewic / * what should be returned * /, $ test_name / * your test name * /);    

No comments:

Post a Comment