DataSift\Storyplayer\PlayerLib\Action_Logger::closeAllOpenActions PHP Метод

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

public closeAllOpenActions ( )
    public function closeAllOpenActions()
    {
        // do we have any empty log items?
        if (!$this->action) {
            return;
        }
        // close the action
        if ($this->action->getIsOpen()) {
            $this->action->endAction();
        }
        // forget the action
        $this->action = null;
    }

Usage Example

Пример #1
0
 /**
  * @covers DataSift\Storyplayer\PlayerLib\Action_Logger::closeAllOpenActions
  */
 public function testCanCloseNestedOpenActions()
 {
     // ----------------------------------------------------------------
     // setup your test
     // the message we want to log
     $msg = "This is a test message";
     $expectedMsg1 = $msg;
     $expectedMsg2 = "  " . $msg;
     // our mock output facade
     $output = Mockery::mock("DataSift\\Storyplayer\\Output");
     $output->shouldReceive('logPhaseActivity')->once()->with($expectedMsg1, null);
     $output->shouldReceive('logPhaseActivity')->once()->with($expectedMsg2, null);
     // our mock DI container
     $i = new Injectables();
     $i->dataFormatter = new DataFormatter();
     $i->dataFormatter->setIsVerbose(true);
     $i->output = $output;
     // and, our test subject
     $obj = new Action_Logger($i);
     // open a couple of messages
     $log1 = $obj->startAction($msg);
     $log2 = $obj->startAction($msg);
     // ----------------------------------------------------------------
     // perform the change
     $obj->closeAllOpenActions();
     // ----------------------------------------------------------------
     // test the results
     $this->assertTrue($log2->getIsComplete());
     $this->assertTrue($log1->getIsComplete());
     $action = $obj->getOpenAction();
     $this->assertNull($action);
     // all done
     Mockery::close();
 }
All Usage Examples Of DataSift\Storyplayer\PlayerLib\Action_Logger::closeAllOpenActions