Issue with HTTP Feature Testing |
I'll try to be as short with this as i can: so I have a test file with contents:
PHP Code: <?php Within the controller i have a simple check right now just to get parsed query string array: PHP Code: <?php Now i run tests via composer run-script test and results are: Quote:Array() // this is the $_GET array. Any ideas what i should try or is there a thing that you see right away that is wrong with my code? Any help Helps!
Alright i found an aswer for my own question. I think it has to do with
Quote:The $params array does not make sense for every HTTP verb, but is included for consistency. as written in the manual that not all request types support $params. Maybe GET is one of them. But for sake of consistency i wrote my own tiny solution to request endpoints in testing: PHP Code: /** What helped alot is that CodeIgniter actually got my request by: PHP Code: $this->request->getBody(); Hope this helps someone!
Thanks for sharing your solution! Just to add: FeatureTestCase does not necessarily populate the superglobals (like $_GET) nor recreate the full URI. I think you *should* still be able to access the parameters from the Request though - try this instead:
PHP Code: public function amethod() |
Welcome Guest, Not a member yet? Register Sign In |