DataSift\Storyplayer\Output::logPhaseSubprocessOutput PHP Method

logPhaseSubprocessOutput() public method

called when a story logs the (possibly partial) output from running a subprocess
public logPhaseSubprocessOutput ( string $msg ) : void
$msg string the output to log
return void
    public function logPhaseSubprocessOutput($msg)
    {
        // enforce our input type
        Contract::RequiresValue($msg, is_string($msg));
        // keep track of what was attempted, in case we need to show
        // the user what was attempted
        $this->activityLog[] = ['ts' => time(), 'text' => $msg, 'codeLine' => null, 'isOutput' => true];
        // call all of our plugins
        foreach ($this->plugins as $plugin) {
            $plugin->logPhaseSubprocessOutput($msg);
        }
    }

Usage Example

Exemplo n.º 1
0
 /**
  * @covers DataSift\Storyplayer\Output::logPhaseSubprocessOutput()
  */
 public function testCanLogPhaseSubprocessOutput()
 {
     // ----------------------------------------------------------------
     // setup the test
     $msg = "a unit-test is running ... do not be alarmed!";
     $plugin1 = Mockery::mock("DataSift\\Storyplayer\\OutputLib\\OutputPlugin");
     $plugin1->shouldReceive('logPhaseSubprocessOutput')->once()->with($msg);
     $plugin2 = Mockery::mock("DataSift\\Storyplayer\\OutputLib\\OutputPlugin");
     $plugin2->shouldReceive('logPhaseSubprocessOutput')->once()->with($msg);
     $obj = new Output();
     $obj->usePluginInSlot($plugin1, "console");
     $obj->usePluginInSlot($plugin2, "slot1");
     // ----------------------------------------------------------------
     // perform the change
     $obj->logPhaseSubprocessOutput($msg);
     // ----------------------------------------------------------------
     // test the results
     Mockery::close();
 }