Пример #1
0
 protected function setUp()
 {
     $this->db = TestsHelpers::getDb();
     $this->iniParams = TestsHelpers::getIniParams();
     $systemLogger = LoggerFactory::getFileLogger(TestsHelpers::getSystemLog(), Logger::INFO);
     $this->connectorSet = new OkToBf($this->iniParams, $systemLogger);
     $this->connector = null;
 }
Пример #2
0
 public function testLogError()
 {
     try {
         throw new E7Exception("test de log d'erreur");
     } catch (E7Exception $e) {
         ExceptionsHandler::logError($e, $this->systemLogger);
     }
     $this->assertFileExists(TestsHelpers::getSystemLog());
     $logContent = file_get_contents(TestsHelpers::getSystemLog());
     $this->assertContains("fLog.ERROR: E7\\Helpers\\Exceptions\\E7Exception", $logContent);
 }
Пример #3
0
 public function testExecuteFail()
 {
     $sqlWithError = "THIS IS NOT AN SQL QUERY";
     try {
         $this->db->execute($sqlWithError, array());
     } catch (E7Exception $e) {
         ExceptionsHandler::logError($e, $this->systemLogger);
     }
     $this->assertFileExists(TestsHelpers::getSystemLog());
     $logContent = file_get_contents(TestsHelpers::getSystemLog());
     $this->assertContains("SQL error", $logContent);
 }
Пример #4
0
 public function testFileAndMailLogger()
 {
     $systemLog = TestsHelpers::getSystemLog();
     $this->log = LoggerFactory::getFileAndMailLogger($systemLog, Logger::ERROR, "*****@*****.**", Logger::ERROR);
     $this->assertInstanceOf("E7\\Helpers\\Logger", $this->log);
     $this->log->info("test info ééé Straße");
     $this->log->warning("test warning ààà Straße");
     $this->log->error("test error ùùù Straße");
     $logContent = file_get_contents($systemLog);
     $this->assertNotContains("test info ééé Straße", $logContent);
     $this->assertNotContains("test warning ààà Straße", $logContent);
     $this->assertContains("test error ùùù Straße", $logContent);
 }
 protected function setUp()
 {
     $this->iniParams = TestsHelpers::getIniParams();
     $this->systemLogger = LoggerFactory::getFileLogger(TestsHelpers::getSystemLog(), Logger::INFO);
 }
Пример #6
0
 public function testCreateSeedsUnknownSeedsId()
 {
     $argv = array(__FILE__, "seeds", "-c", E7_PATH . "/main/E7/ConnectorsSets/OkToBf/configTest.ini", "-i", "doesntexists");
     $e7Bot = new E7Bot($argv);
     $e7Bot->run();
     $logContent = file_get_contents(TestsHelpers::getSystemLog());
     $this->assertContains("InvalidArgumentException: Unknown Seed Id <doesntexists>", $logContent);
 }