public function startAction($message, $codeLine = null)
{
// do we have an open action?
if (!$this->action || !$this->action->getIsOpen()) {
$openItem = $this->action = new Action_LogItem($this->injectables, 1);
} else {
// this is a new nested item
$openItem = $this->action->newNestedAction();
}
return $openItem->startAction($message, $codeLine);
}
/** * @covers DataSift\Storyplayer\PlayerLib\Action_Logger::startAction * @covers DataSift\Storyplayer\PlayerLib\Action_Logger::getOpenAction */ public function testGetOpenActionReturnsNullWhenNoActionOpen() { // ---------------------------------------------------------------- // setup your test // the message we want to log $expectedMsg = "This is a test message"; // our mock output facade $output = Mockery::mock("DataSift\\Storyplayer\\Output"); $output->shouldReceive('logPhaseActivity')->once()->with($expectedMsg, 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); $log = $obj->startAction($expectedMsg); $log->endAction(); // ---------------------------------------------------------------- // perform the change $action = $obj->getOpenAction(); // ---------------------------------------------------------------- // test the results $this->assertNull($action); // all done Mockery::close(); }