public function register()
 {
     $this->app->bind('db', function ($app) {
         $db = new Driver($app['config']['database.connections.pgsql'], 'Log');
         $debug = env('APP_ENV') === 'development';
         if ($debug === true) {
             $db->setDebug(true)->isLog(true);
         }
         return $db;
     });
 }
 public function testSelectFetchRowAsObject()
 {
     $result = DB::select()->from('public.users')->where('id', 5)->fetchRow();
     $this->assertThat($result, $this->logicalAnd($this->isInstanceOf('stdClass'), $this->ObjectHasAttribute('name')));
 }
 public function testCallFunctionInFrom()
 {
     $result = DB::select('generate_series(?::date, ?::date, ?)::date', ['2015-04-25', '2015-04-27', '1 day'])->fetchColumn();
     $this->assertEquals(['2015-04-25', '2015-04-26', '2015-04-27'], $result);
 }
示例#4
0
 /**
  * @depends testFillCreatedTable
  */
 public function testGetLogs()
 {
     $result = DB::getQueriesLog();
     $this->assertCount(5, $result);
 }