DataSift\Storyplayer\PlayerLib\Action_LogItemTest::testCanCaptureOutput PHP Method

testCanCaptureOutput() public method

    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();
    }