DataSift\Storyplayer\Reports\TapReport::endStoryplayer PHP Method

endStoryplayer() public method

public endStoryplayer ( $duration ) : void
return void
    public function endStoryplayer($duration)
    {
        // right, now we need to report on what we've seen
        $fp = fopen($this->filename, "w");
        if (!$fp) {
            throw new E5xx_CannotCreateReportFile($this->filename);
        }
        // write out the header
        fwrite($fp, "TAP version 13" . PHP_EOL);
        fwrite($fp, "1.." . $this->testCount . PHP_EOL);
        // write out each test in turn
        $storyCounter = 1;
        foreach ($this->tests as $storyResult) {
            switch ($storyResult->resultCode) {
                case $storyResult::PASS:
                    $this->writeOkay($fp, $storyCounter, $storyResult, 'Pass');
                    break;
                case $storyResult::FAIL:
                    $this->writeNotOkay($fp, $storyCounter, $storyResult, 'Fail');
                    break;
                case $storyResult::INCOMPLETE:
                    $this->writeNotOkay($fp, $storyCounter, $storyResult, 'Incomplete');
                    break;
                case $storyResult::BLACKLISTED:
                    $this->writeOkay($fp, $storyCounter, $storyResult, 'Blacklisted');
                    break;
                case $storyResult::ERROR:
                default:
                    $this->writeNotOkay($fp, $storyCounter, $storyResult, 'Error');
                    break;
            }
        }
        // all done
        fclose($fp);
    }