[Halo] add a Trait to test HTTP headers

Review Request #326 — Created July 18, 2014 and updated

tardypad
Lunr
tardypad:http_headers_test_trait
327
lunr
Can be used to properly test all headers, including the ones setting the return code, using xdebug_get_headers()

Main problems that were faced with previous tests of headers
- xdebug_get_headers doesn't return headers of type 'HTTP/1.1 return_code message'
- use of http_response_code was not tested as well

The trait can be improved if you think it's needed:
- take into account response code when set via the 3rd parameter of the 'header' function
- take into account headers with same name and assert on the final result
Traits can't be unit tested using the current phpunit version 3.7.37
tardypad
Review request changed

Description:

   

Can be used to properly test all headers, including the ones setting the return code, using xdebug_get_headers()

   
  +

Main problems that were faced with previous tests of headers

  + - xdebug_get_headers doesn't return headers of type 'HTTP/1.1 return_code message'
  + - use of http_response_code was not tested as well

  +
   

The trait can be improved if you think it's needed:

    - take into account response code when set via the 3rd parameter of the 'header' function
    - take into account headers with same name and assert on the final result

pprkut
  1. I believe you that this works, but it's just way too ugly and convoluted. There needs to be a better way to achieve the same thing, even if it needs more code.
    1. Is it ugly in the way that this has to be used like in http://reviews.lunr.nl/r/327/diff/#index_header?
      Or in the way that it is redefining functions? In that case, I'm open for other suggestions.
  2. 
      
Loading...