} $plot->SetDataValues($data1); $plot->DrawGraph(); ob_start(); $plot->PrintImageFrame(); $frame1 = ob_get_clean(); $plot->SetDataValues($data2); $plot->DrawGraph(); ob_start(); $plot->PrintImageFrame(); $frame2 = ob_get_clean(); if (!check_frame($frame1, $boundary) || !check_frame($frame2, $boundary)) { # This is kind of useless for debugging, but the frame isn't text so # we can't just print it... fwrite(STDERR, "Error: Frame(s) did not match expected pattern\n"); $errors++; } ob_start(); $plot->EndStream(); $eof = ob_get_clean(); if (!preg_match("--{$boundary}--", $eof)) { fwrite(STDERR, "Error: Did not match end of stream: '{$eof}'\n"); $errors++; } echo basename(__FILE__) . ': '; if ($errors > 0) { echo "Failed\n"; exit(1); } echo "Passed\n"; # Testing requires falling off the end if the test passes.