mercredi 25 mars 2015

phpunit with output buffering

I'm trying to integrate PHPunit into a big project, everything seems fine except it seems that all methods that rely on ob_start() will result in a risky test.


Reading online, it seems risky tests are such tests which execute code not covered by the testing method. However, I haven't used the @covers annotation at all, And this happens only on ob_start().


So a few questions :



  1. Is it possible to resolve this issue?

  2. Is there something inherently wrong with ob_start when it comes to testing?

  3. Is there a way around it?(if not possible to resolve it).


The use case is using a framework who's views are returned(instead of sent to the browser), Codeigniter comes as a classic example, where you can return views. Returning views depend on ob_start(). Thanks alot!


Aucun commentaire:

Enregistrer un commentaire