/**
  * Test Slim Logging for given mode
  *
  * Pre-conditions:
  * Slim app instantiated;
  * Set custom Logger for current app mode;
  *
  * Post-conditions:
  * Slim app Logger correct based on mode;
  */
 public function testSlimLoggerInMode()
 {
     $app = new Slim(array('mode' => 'test'));
     $app->configureMode('test', function () use($app) {
         $app->config(array('log.enable' => true, 'log.logger' => new CustomLogger()));
     });
     $app->configureMode('development', function () use($app) {
         $app->config(array('log.enable' => true));
     });
     $this->assertTrue($app->getLog()->getLogger() instanceof CustomLogger);
 }
Exemple #2
0
 /**
  * Test get log
  *
  * This asserts that a Slim app has a default Log
  * upon instantiation. The Log itself is tested
  * separately in another file.
  */
 public function testGetLog()
 {
     $s = new Slim();
     $this->assertInstanceOf('Slim_Log', $s->getLog());
 }
Exemple #3
0
<?php

require 'Slim/Slim.php';
require 'Slim/db.php';
/***********DB Connection start************/
include 'db_config.php';
/***********DB Connection End************/
/************Modules Include here**************/
include 'Slim/modules/user_manager.php';
include 'Slim/modules/customer_manager.php';
/************Modules End**************/
//$app = new Slim();
$app = new Slim(array('log.enable' => true));
/***************Error Handling*************/
$app->get('/', function () use($app) {
    $log = $app->getLog();
    $log->debug('root');
});
/***************Error Handling*************/
/************Create routes ************/
include 'routes.php';
/************End routes ************/
$app->run();