/** * @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(); }
/** * @return void */ public function closeAllOpenActions() { return $this->actionLogger->closeAllOpenActions(); }