DataSift\Storyplayer\PlayerLib\Action_LogItem::captureOutput PHP Method

captureOutput() public method

public captureOutput ( $text ) : void
return void
    public function captureOutput($text)
    {
        // trick the logger into indenting the output one more
        $this->nestLevel++;
        // NOTE: output captured from sub-processes is NEVER subjected
        // to truncation if -V is not used from the command-line
        $this->output->logPhaseSubprocessOutput($text);
        // restore our original output nesting level
        $this->nestLevel--;
    }

Usage Example

Esempio n. 1
0
 /**
  * @covers DataSift\Storyplayer\PlayerLib\Action_LogItem::captureOutput
  * @covers DataSift\Storyplayer\PlayerLib\Action_LogItem::getIsOpen
  */
 public function testCanCaptureOutput()
 {
     // ----------------------------------------------------------------
     // setup your test
     // the messages we are logging
     $startMsg1 = "This is a test message";
     $startMsg2 = "This is a nested message";
     // our DI container
     $i = new Injectables();
     // our mocked output object
     $i->output = Mockery::mock("DataSift\\Storyplayer\\Output");
     $i->output->shouldReceive('logPhaseActivity')->once()->with($startMsg1, null);
     $i->output->shouldReceive('logPhaseSubprocessOutput')->once()->with($startMsg2);
     // our real data formatter
     $i->dataFormatter = new DataFormatter();
     // our unit under test
     $obj = new Action_LogItem($i, 1);
     $obj->startAction($startMsg1);
     // make sure the message started
     $this->assertNotNull($obj->getIsOpen());
     // ----------------------------------------------------------------
     // perform the change
     $obj->captureOutput($startMsg2);
     // ----------------------------------------------------------------
     // test the results
     Mockery::close();
 }