DataSift\Storyplayer\CommandLib\CommandRunnerTest::testCapturesStderrFromTheCommand PHP Метод

testCapturesStderrFromTheCommand() публичный Метод

    public function testCapturesStderrFromTheCommand()
    {
        // ----------------------------------------------------------------
        // setup your test
        // our test subject
        $obj = new CommandRunner();
        // a fake logging object
        $log = Mockery::mock("DataSift\\Storyplayer\\PlayerLib\\Action_LogItem");
        $log->shouldReceive('endAction')->once();
        $log->shouldReceive('captureOutput')->once();
        // our mocked $st
        $st = Mockery::mock("DataSift\\Storyplayer\\PlayerLib\\StoryTeller");
        $st->shouldReceive('startAction')->andReturn($log);
        // our example command
        $helperCmd = "echo fred >&2";
        // ----------------------------------------------------------------
        // perform the change
        $result = $obj->runSilently($st, $helperCmd);
        // ----------------------------------------------------------------
        // test the results
        $this->assertTrue($result instanceof CommandResult);
        $this->assertEquals("fred" . PHP_EOL, $result->output);
    }