Esempio n. 1
0
 public static function setUpBeforeClass()
 {
     $myConfig = new GetYAMLConfig();
     self::$config = $myConfig->getConfigData();
     $config = array('driver' => self::$config['database']['driver'], 'host' => self::$config['database']['host'], 'username' => self::$config['database']['user'], 'database' => self::$config['database']['database'], 'password' => self::$config['database']['password'], 'charset' => self::$config['database']['charset'], 'port' => self::$config['database']['port'], 'persistent' => self::$config['database']['persistent'], 'dsn' => self::$config['database']['dsn']);
     self::$db = new Connection($config);
     self::$db->query("CREATE TABLE IF NOT EXISTS [routers] (\n  \t\t\t\t\t[id] int(11) NOT NULL AUTO_INCREMENT,\n  \t\t\t\t\t[addr] char(15) COLLATE utf8_bin NOT NULL,\n\t\t\t\t\t[port] smallint(5) UNSIGNED DEFAULT NULL,\n\t\t\t\t\t[identity] varchar(255) COLLATE utf8_bin DEFAULT NULL,\n  \t\t\t\t\t[created] datetime NOT NULL,\n  \t\t\t\t\t[modify] datetime DEFAULT NULL,\n  \t\t\t\t\t[lastbackup] datetime DEFAULT NULL,\n\t\t\t\t\tPRIMARY KEY ([id])\n\t\t\t\t\t) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;\n\t\t\t\t\t");
     $db = new RouterBoardDBAdapter(self::$config, new OutputLogger(new NullOutput()));
     for ($i = 1; $i < 11; $i++) {
         $db->addIP('192.168.1.' . $i, '2345', 'RB-Test' . $i);
     }
 }
<?php

use Symfony\Component\Console\Application;
use App\Config\GetYAMLConfig;
use App\Console\CliWDSimple;
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'vendor/autoload.php';
try {
    $myConfig = new GetYAMLConfig();
    $config = $myConfig->getConfigData();
    $application = new Application("Let's Encrypt Certificate Watchdog", "0.0.3");
    $application->add(new CliWDSimple($config));
    $application->run();
} catch (Exception $e) {
    echo 'Caught exception: ', $e->getMessage(), "\n";
}
 public function testConfig()
 {
     $config = new GetYAMLConfig();
     $this->assertTrue(is_array($config->getConfigData()));
 }