Working on a project which used Slim 2 and Mustache templates.

To unit test flash messages (we used an intermediary class, to inject data into the Mustache templates)

@session_start();
$this->app = new \Slim\Slim();
$this->app->environment['slim.flash'] = new \Slim\Middleware\Flash();

and

public function testFlashMessagesAreReturnedWhenOneAdded()
{
    $this->app->flashNow('info', ['type' => 'info', 'message' => __FUNCTION__]);
    $dataBuilder = new DataBuilder($this->app, 'Test');
    $data = $dataBuilder->getData();
    $this->assertNotEmpty($data->flash, 'Flash messages were not returned from databuilder get data though one was added');
}