Exemplo n.º 1
0
 public function testCountErrors()
 {
     require_once TEST_FILES . 'config/sources.php';
     $obj = new _LangManager();
     $reference_data = $obj->loadSource($sites[2], 'en-US', 'page.lang');
     $locale_data = $obj->loadSource($sites[2], 'it', 'page.lang');
     $analysis_data = $obj->analyzeLangFile($sites[2], 'it', 'page.lang', $reference_data);
     $this->integer($obj->countErrors($analysis_data['errors'], 'all'))->isEqualTo(6);
     $this->integer($obj->countErrors($analysis_data['errors']))->isEqualTo(6);
     $this->integer($obj->countErrors($analysis_data['errors'], 'python'))->isEqualTo(5);
     $this->integer($obj->countErrors($analysis_data['errors'], 'length'))->isEqualTo(1);
     $this->integer($obj->countErrors($analysis_data['errors'], 'random'))->isEqualTo(0);
 }
Exemplo n.º 2
0
 $displayed_filename = $website_data_source == 'lang' ? $filename : basename($filename);
 $file_flags = Project::getFileFlags($website, $filename, $current_locale);
 if ($website_data_source == 'lang') {
     $locale_filename = Project::getLocalFilePath($website, $current_locale, $filename);
     if (!is_file($locale_filename) || Project::isObsoleteFile($website, $filename, $current_locale)) {
         // File is missing or marked as obsolete
         continue;
     }
     // Load reference strings
     $reference_data = LangManager::loadSource($website, $reference_locale, $filename);
     $locale_analysis = LangManager::analyzeLangFile($website, $current_locale, $filename, $reference_data);
     $export_data[$website_name][$displayed_filename]['identical'] = count($locale_analysis['Identical']);
     $export_data[$website_name][$displayed_filename]['missing'] = count($locale_analysis['Missing']);
     $export_data[$website_name][$displayed_filename]['obsolete'] = count($locale_analysis['Obsolete']);
     $export_data[$website_name][$displayed_filename]['translated'] = count($locale_analysis['Translated']);
     $export_data[$website_name][$displayed_filename]['errors'] = LangManager::countErrors($locale_analysis['errors']);
 } else {
     $file_analysis = RawManager::compareRawFiles($website, $current_locale, $filename);
     $cmp_result = $file_analysis['cmp_result'];
     $export_data[$website_name][$displayed_filename]['status'] = $cmp_result;
 }
 $export_data[$website_name][$displayed_filename]['data_source'] = $website_data_source;
 if (Project::isCriticalFile($website, $filename, $current_locale)) {
     $export_data[$website_name][$displayed_filename]['critical'] = true;
 } else {
     $export_data[$website_name][$displayed_filename]['critical'] = false;
 }
 // Flags
 if ($file_flags) {
     $export_data[$website_name][$displayed_filename]['flags'] = $file_flags;
 }