PHPUnit_Extensions_OutputTestCase::runTest PHP Method

runTest() protected method

protected runTest ( ) : mixed
return mixed
    protected function runTest()
    {
        ob_start();
        $this->obActive = TRUE;
        try {
            $testResult = parent::runTest();
        } catch (Exception $e) {
            ob_end_clean();
            $this->obActive = FALSE;
            throw $e;
        }
        if ($this->outputCallback === FALSE) {
            $this->output = ob_get_contents();
        } else {
            $this->output = call_user_func_array($this->outputCallback, array(ob_get_contents()));
        }
        ob_end_clean();
        $this->obActive = FALSE;
        if ($this->expectedRegex !== NULL) {
            $this->assertRegExp($this->expectedRegex, $this->output);
            $this->expectedRegex = NULL;
        } else {
            if ($this->expectedString !== NULL) {
                $this->assertEquals($this->expectedString, $this->output);
                $this->expectedString = NULL;
            }
        }
        return $testResult;
    }

Usage Example

示例#1
0
 protected function runTest()
 {
     $testResult = parent::runTest();
     if ($this->_outputCheck) {
         $this->assertTrue(call_user_func($this->_outputCheck, $this->output));
     }
     return $testResult;
 }