Hi, I was trying to learn unit test with PHP. I know it's a bit too far for someone who just jump into unit test in PHP. Anyway, here's the case:
function doresize(&$mp3file)
{
global $tmpdir, $mp3info, $ffmpeg;
if(dirname($mp3file) != $tmpdir )
{
copy($mp3file , $tmpdir . '/' . $mp3file);
$mp3file = $tmpdir . '/' . $mp3file;
}
$mp3filenew = basename($file, '.swf') . "_new.mp3";
$command2 = "$mp3info -x \"$mp3file\" 2> /dev/null";
exec($command2, $buffer);
$mp3length = getLengthFromBuffer($buffer);
debug(" \$mp3length: $mp3length");
$lengthTranslated = roundLengthToSeconds($mp3length);
$maxlength = floor( $lengthTranslated / 2);
$halfmaxlength = floor( $maxlength / 2);
$start = rand($halfmaxlength, $maxlength);
$command3 = "$ffmpeg -y -acodec copy -ss $start -t $maxlength -i \"$mp3file\" $mp3filenew 2> /dev/null";
exec($command3);
@unlink($mp3file);
rename($mp3filenew, $mp3file);
}
From the code above, what aspect of that code should I add in test case?
FYI: The code above is used to cut mp3 file in half.