mageekguy\atoum\includer::getFirstError PHP Method

getFirstError() public method

public getFirstError ( )
    public function getFirstError()
    {
        $firstError = null;
        if (sizeof($this->errors) > 0) {
            $firstError = $this->errors[0];
        }
        return $firstError;
    }

Usage Example

Exemplo n.º 1
0
 public function testGetFirstError()
 {
     $this->if($includer = new testedClass($adapter = new atoum\test\adapter()))->then->variable($includer->getFirstError())->isNull()->if($adapter->set_error_handler = function ($errorHandler) {
         set_error_handler($errorHandler);
         return null;
     })->and($fileWithError = stream::get())->and($fileWithError->file_get_contents = '<?php trigger_error(\'' . ($message = uniqid()) . '\', E_USER_WARNING); ?>')->and($includer->includePath($fileWithError))->then->array($error = $includer->getFirstError())->isNotEmpty()->integer($error[0])->isEqualTo(E_USER_WARNING)->string($error[1])->isEqualTo($message);
 }