Esempio n. 1
0
 static function checkChangesToFile($snapshot, $filepath)
 {
     $lines = array();
     if (is_file($filepath)) {
         $fileNow = FileSystemTools::tail($filepath, 30);
         if (strlen($fileNow) > 0 && strlen($snapshot) > 0) {
             $diff = Diff::compare($snapshot, $fileNow);
             if (count($diff[Diff::INSERTED]) > 0) {
                 foreach ($diff as $dk => $dv) {
                     if ($dv[1] == Diff::INSERTED) {
                         if (strlen(trim($dv[0])) > 0) {
                             $lines[] = $dv[0];
                         }
                     }
                 }
             }
         }
     }
     return $lines;
 }
Esempio n. 2
0
    $output[] = $v;
}
$output[] = "-------------------------------------------------";
// DUMP OUTPUT
if (php_sapi_name() == 'cli') {
    echo "\n" . implode("\n", $output) . "\n";
    $output = array();
}
// run all test suites in each test folder
$passedAllTests = true;
foreach ($testFolders as $key => $folder) {
    // take a snapshot of all log files
    $snapshots = [];
    if (!empty(TestConfig::getConfig('testLogFiles'))) {
        foreach (explode(",", TestConfig::getConfig('testLogFiles')) as $k => $logFile) {
            $snapshots[$logFile] = FileSystemTools::tail($logFile, 30);
        }
    }
    // run the test
    echo 'RUN TESTS ' . $folder;
    ob_start();
    $testResult = TestRunner::runTests($folder);
    $testOutput = ob_get_contents();
    ob_end_clean();
    if (!$testResult['result']) {
        $passedAllTests = false;
        $output[] = "TEST FAILED";
    } else {
        $output[] = "TEST PASSED";
    }
    $output[] = $testOutput;