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

testCanStartANestedAction() public method

    public function testCanStartANestedAction()
    {
        // ----------------------------------------------------------------
        // setup your test
        // the messages we are logging
        $startMsg1 = "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($startMsg1, null);
        // our real data formatter
        $i->dataFormatter = new DataFormatter();
        // our unit under test
        $obj = new Action_LogItem($i, 1);
        $obj->startAction($startMsg1);
        // make sure the message started
        $this->assertNotNull($obj->getStartTime());
        // ----------------------------------------------------------------
        // perform the change
        $nestedObj = $obj->newNestedAction();
        // ----------------------------------------------------------------
        // test the results
        $this->assertTrue($nestedObj instanceof Action_LogItem);
        $this->assertEquals(2, $nestedObj->getNestLevel());
        Mockery::close();
    }