public function testGetLocales() { $obj = new _Tools(TEST_FILES); $this->array($obj->getLocales('pootle'))->isEqualTo([]); $this->array($obj->getLocales('pontoon'))->isEqualTo(['ast', 'bg', 'bn-IN']); $this->array($obj->getLocales('all'))->isEqualTo(['locamotion' => [], 'pontoon' => ['ast', 'bg', 'bn-IN']]); }
$repo = Utils::getQueryParam('repo'); $bugzilla = Utils::getQueryParam('bugzilla'); $tool = Utils::getQueryParam('tool'); $repos = new Repositories($source_path); $json_data = new Json(); // Only one repo requested if ($repo != '') { $locales = $repos->getSingleRepository($repo); if ($locales) { die($json_data->outputContent($locales)); } else { http_response_code(400); die('ERROR: unknown repository.'); } } // Only one type of repo requested if ($type != '') { die($json_data->outputContent($repos->getTypeRepositories($type))); } // Bugzilla components if ($bugzilla != '') { $bugzilla_query = new Bugzilla($source_path); die($json_data->outputContent($bugzilla_query->getBugzillaComponents($bugzilla))); } // Locales working in tools if ($tool != '') { $tools_query = new Tools($source_path); die($json_data->outputContent($tools_query->getLocales($tool))); } // Display a list of all repositories die($json_data->outputContent($repos->getRepositories()));