/**
  * @depends testGetLogs
  */
 public function testGetLog()
 {
     $log = $this->logViewer->getFirstClient()->getFirstLog();
     $this->assertInstanceOf('Syonix\\LogViewer\\LogFile', $log);
     $this->assertEquals('Log1', $log->getName());
     return $log;
 }
Example #2
0
        return $app->redirect($app['url_generator']->generate('home'));
    })->assert('url', '.+');
    // Match any route;
} else {
    $app->get('/', function () use($app) {
        if (!is_readable(CONFIG_FILE)) {
            throw new \Syonix\LogViewer\Exceptions\ConfigFileMissingException();
        }
        return $app->redirect($app['url_generator']->generate('home'));
    });
    $app->get('/login', function (\Symfony\Component\HttpFoundation\Request $request) use($app) {
        return $app['twig']->render('login.html.twig', array('create_success' => false, 'error' => $app['security.last_error']($request)));
    })->bind("login");
    $app->get('/logs', function () use($app) {
        $viewer = new Syonix\LogViewer\LogViewer($app['config']['logs']);
        $client = $viewer->getFirstClient();
        $log = $client->getFirstLog();
        return $app->redirect($app['url_generator']->generate('log', array('clientSlug' => $client->getSlug(), 'logSlug' => $log->getSlug())));
    })->bind("home");
    $app->get('/logs/{clientSlug}', function ($clientSlug) use($app) {
        $viewer = new Syonix\LogViewer\LogViewer($app['config']['logs']);
        $client = $viewer->getClient($clientSlug);
        $log = $client->getFirstLog();
        if (is_null($log)) {
            $app->abort(404, "Client not found");
        }
        return $app->redirect($app['url_generator']->generate('log', array('clientSlug' => $clientSlug, 'logSlug' => $log->getSlug())));
    })->bind("client");
    $controller_log = function (\Symfony\Component\HttpFoundation\Request $request, $clientSlug, $logSlug) use($app) {
        try {
            $viewer = new Syonix\LogViewer\LogViewer($app['config']['logs']);