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

testCanStartAnAction() public method

    public function testCanStartAnAction()
    {
        // ----------------------------------------------------------------
        // setup your test
        // the message we are logging
        $msg = "This is a test message";
        // our DI container
        $i = new Injectables();
        // our mocked output object
        $i->output = Mockery::mock("DataSift\\Storyplayer\\Output");
        $i->output->shouldReceive('logPhaseActivity')->once()->with($msg, null);
        // our real data formatter
        $i->dataFormatter = new DataFormatter();
        // our unit under test
        $obj = new Action_LogItem($i, 1);
        $this->assertNull($obj->getStartTime());
        $this->assertFalse($obj->getIsOpen());
        // ----------------------------------------------------------------
        // perform the change
        $obj->startAction($msg);
        // ----------------------------------------------------------------
        // test the results
        $this->assertTrue($obj instanceof Action_LogItem);
        $this->assertEquals(1, $obj->getNestLevel());
        $this->assertNotNull($obj->getStartTime());
        $this->assertTrue($obj->getIsOpen());
        Mockery::close();
    }