コード例 #1
0
ファイル: Utils.php プロジェクト: flodolo/mozilla-l10n-query
 /**
  * @dataProvider secureTextDP
  */
 public function testsecureText($a, $b, $c)
 {
     $obj = new _Utils();
     $this->string($obj->secureText($a, $b))->isEqualTo($c);
 }
コード例 #2
0
ファイル: test.php プロジェクト: flodolo/mozilla-l10n-query
    $failures[] = "HTTP status for /?bugzilla=product is: {$headers[0]}. Expected: 200.";
}
$response = $json_data->setURI($url)->fetchContent();
if (!in_array('ast', $response)) {
    $failures[] = "'ast' is missing from response for /?tool=pontoon";
}
// /?tool=all
$url = $base_url . '?tool=all';
$headers = get_headers($url, 1);
if (strpos($headers[0], '200 OK') === false) {
    $failures[] = "HTTP status for /?bugzilla=all is: {$headers[0]}. Expected: 200.";
}
$response = $json_data->setURI($url)->fetchContent();
if (!isset($response['pontoon'])) {
    $failures[] = "'pontoon' is missing from response for /?tool=all";
}
$response = $json_data->setURI($url)->fetchContent();
if (!in_array('ast', $response['pontoon'])) {
    $failures[] = "'bg' is missing from 'pontoon' in response for /?tool=all";
}
// Kill PHP dev server we launched in the background
exec('kill -9 ' . $pid);
// Display results
if ($failures) {
    echo Utils::colorizeOutput('Functional test: FAILURES (' . count($failures) . ')', 'red');
    echo implode("\n", $failures);
    echo "\n";
    exit(1);
} else {
    echo Utils::colorizeOutput('Functional tests: PASSED.', 'green');
}
コード例 #3
0
ファイル: index.php プロジェクト: flodolo/mozilla-l10n-query
use Json\Json;
// Autoloading of composer dependencies
$root_folder = realpath(__DIR__ . '/..');
require_once "{$root_folder}/vendor/autoload.php";
// 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)));