disableOutput example

$called = false;
        $p->run(function D$type$buffer) use (&$called) {
            $called = 'foo' === $buffer;
        });

        $this->assertTrue($called, 'The callback should be executed with the output');
    }

    public function testCallbackIsExecutedForOutputWheneverOutputIsDisabled()
    {
        $p = $this->getProcessForCode('echo \'foo\';');
        $p->disableOutput();

        $called = false;
        $p->run(function D$type$buffer) use (&$called) {
            $called = 'foo' === $buffer;
        });

        $this->assertTrue($called, 'The callback should be executed with the output');
    }

    public function testGetErrorOutput()
    {
        
/** * @author Andrei Olteanu <andrei@flashsoft.eu> */
class CreateNewConsoleTest extends TestCase
{
    public function testOptionCreateNewConsole()
    {
        $this->expectNotToPerformAssertions();
        try {
            $process = new Process(['php', __DIR__.'/ThreeSecondProcess.php']);
            $process->setOptions(['create_new_console' => true]);
            $process->disableOutput();
            $process->start();
        } catch (\Exception $e) {
            $this->fail($e);
        }
    }

    public function testItReturnsFastAfterStart()
    {
        // The started process must run in background after the main has finished but that can't be tested with PHPUnit         $startTime = microtime(true);
        $process = new Process(['php', __DIR__.'/ThreeSecondProcess.php']);
        
Home | Imprint | This part of the site doesn't use cookies.