Пример #1
0
 public function testWriteError()
 {
     $this->if($generator = new phar\generator(uniqid()))->and($stderr = new \mock\mageekguy\atoum\writers\std\err())->and($this->calling($stderr)->clear = $stderr)->and($this->calling($stderr)->write = function () {
     })->and($generator->setErrorWriter($stderr))->then->object($generator->writeError($error = uniqid()))->isIdenticalTo($generator)->mock($stderr)->call('write')->withArguments(sprintf($generator->getLocale()->_('Error: %s'), $error) . PHP_EOL)->once();
 }
Пример #2
0
<?php

use mageekguy\atoum, mageekguy\atoum\scripts;
require_once __DIR__ . '/../../classes/autoloader.php';
$generator = new scripts\phar\generator(__FILE__);
$generator->setOriginDirectory(__DIR__ . '/../..');
$generator->setStubFile(__DIR__ . '/resources/stub.php');
set_error_handler(function ($error, $message, $file, $line) use($generator) {
    if (error_reporting() !== 0) {
        $generator->writeError($message);
        exit($error);
    }
});
try {
    $generator->run();
} catch (\exception $exception) {
    $generator->writeError($exception->getMessage());
    exit($exception->getCode());
}
exit(0);