public function testGetSingleRepository() { $obj = new _Repositories(TEST_FILES); $result = ['id' => 'gaia_1_3', 'display_order' => 2, 'name' => 'Gaia 1.3', 'locales' => ['ar', 'bg', 'bn-BD', 'ca', 'cs'], 'type' => 'gaia']; $this->array($obj->getSingleRepository('gaia_1_3'))->isEqualTo($result); // Non existing repository $this->boolean($obj->getSingleRepository('foobar'))->isFalse(); }
public function testGetSingleRepository() { $obj = new _Repositories(TEST_FILES); $result = ['id' => 'beta', 'display_order' => 1, 'name' => 'Beta', 'locales' => ['da', 'de', 'dsb', 'el'], 'type' => 'product']; $this->array($obj->getSingleRepository('beta'))->isEqualTo($result); // Non existing repository $this->boolean($obj->getSingleRepository('foobar'))->isFalse(); }
// Override sources for functional tests both locally and on Travis if (getenv('TRAVIS') || getenv('AUTOMATED_TESTS')) { $source_path = "{$root_folder}/tests/testfiles/"; } else { $source_path = "{$root_folder}/app/sources/"; } // Query request $type = Utils::getQueryParam('type'); $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)));