示例#1
0
 /**
  * Generate main configuration files
  */
 public static function generateMainFiles()
 {
     $event = static::$event;
     /* Generate Main File */
     ConfigGenerateMainRepository::generate(static::$fileList, $event->getPollerId(), static::$path, "centengine.cfg");
     $event->setOutput('centengine.cfg');
     /* Generate Debugging Main File */
     ConfigGenerateMainRepository::generate(static::$fileList, $event->getPollerId(), static::$path, "centengine-testing.cfg", 1);
     $event->setOutput('centengine-testing.cfg');
 }
 public function testGenerate()
 {
     $fileList = array();
     $pollerId = 1;
     ConfigGenerateMainRepository::generate($fileList, $pollerId, $this->tmpDir . '/', 'centengine.cfg');
     $this->assertEquals(array('main_file' => array($this->tmpDir . '/1/centengine.cfg')), $fileList);
     $content = file_get_contents($this->tmpDir . '/1/centengine.cfg');
     /* Remove line with the generate date */
     $lines = explode("\n", $content);
     $lines = preg_grep('/^#\\s+Last.*#$/', $lines, PREG_GREP_INVERT);
     $content = join("\n", $lines);
     $resultContent = file_get_contents(dirname(__DIR__) . '/data/configfiles/centengine1.cfg');
     $this->assertEquals($resultContent, $content);
 }