mardi 2 août 2016

PHPUnit - Test fopen, fwrite return

I used PHPUnit to test a function with contents:

$fp = fopen($file_path,'wb');

if( $fp === false ) {
     ...
}

$ret = fwrite($fp, $content) ;
if( $ret === false ) {
     ...
}

I have a problem, fopen always return a resource and fwrite always return a integer value. How should i do? Thank everyone :).

Aucun commentaire:

Enregistrer un commentaire