public function testException()
 {
     $dsn = 'doenotexist';
     $appender = new LoggerAppenderPDO("myname");
     $appender->setDSN($dsn);
     $appender->setCreateTable(true);
     $catchedException = null;
     try {
         $appender->activateOptions();
     } catch (LoggerException $e) {
         $catchedException = $e;
     }
     self::assertNotNull($catchedException);
 }
 /**
  * Return a PDO logger appender that will reference the given bucket id
  *
  * @param ForgeUpgrade_Bucket $bucket The bucket
  *
  * @return LoggerAppenderPDO
  */
 public function getBucketLoggerAppender(ForgeUpgrade_Bucket $bucket)
 {
     $this->initOptions();
     $logger = new LoggerAppenderPDO();
     $logger->setUser($this->user);
     $logger->setPassword($this->password);
     $logger->setDSN($this->dsn);
     $logger->setTable('forge_upgrade_log');
     $logger->setInsertSql('INSERT INTO forge_upgrade_log (id, bucket_id, timestamp, logger, level, message, thread, file, line) VALUES (NULL,' . $bucket->getId() . ',?,?,?,?,?,?,?)');
     $logger->setInsertPattern('%d,%c,%p,%m,%t,%F,%L');
     $logger->activateOptions();
     return $logger;
 }
 /**
  * Check whether close() actually closes the database connection. 
  */
 public function testClose()
 {
     $event = new LoggerLoggingEvent("LoggerAppenderPDOTest", new Logger("TEST"), LoggerLevel::getLevelError(), "testmessage");
     $appender = new LoggerAppenderPDO("myname");
     $appender->setDSN(self::$dsn);
     $appender->activateOptions();
     $appender->append($event);
     $appender->close();
     self::assertNull($appender->getDatabaseHandle());
 }
 /** Tests if log4php throws an Exception if the appender does not work. 
  * @expectedException LoggerException
  */
 public function testException()
 {
     $dsn = 'doenotexist';
     $appender = new LoggerAppenderPDO("myname");
     $appender->setDSN($dsn);
     $appender->setCreateTable(true);
     $appender->activateOptions();
 }