/** * @covers DataSift\Storyplayer\PlayerLib\Action_LogItem::endAction * @covers DataSift\Storyplayer\PlayerLib\Action_LogItem::getEndTime * @covers DataSift\Storyplayer\PlayerLib\Action_LogItem::getOpenAction */ public function testCanEndAnActionWithMessage() { // ---------------------------------------------------------------- // setup your test // the messages we are logging $startMsg = "This is a test message"; $endMsg = "this is the end message"; // our DI container $i = new Injectables(); // our mocked output object $i->output = Mockery::mock("DataSift\\Storyplayer\\Output"); $i->output->shouldReceive('logPhaseActivity')->once()->with($startMsg, null); $i->output->shouldReceive('logPhaseActivity')->once()->with('... ' . $endMsg, null); // our real data formatter $i->dataFormatter = new DataFormatter(); // our unit under test $obj = new Action_LogItem($i, 1); $obj->startAction($startMsg); // make sure the message started $this->assertNotNull($obj->getStartTime()); // ---------------------------------------------------------------- // perform the change $obj->endAction($endMsg); // ---------------------------------------------------------------- // test the results $this->assertNotNull($obj->getEndTime()); $this->assertNull($obj->getOpenAction()); Mockery::close(); }