コード例 #1
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');
}
コード例 #2
0
ファイル: Utils.php プロジェクト: flodolo/mozilla-l10n-query
 /**
  * @dataProvider colorizeOutputDP
  */
 public function testColorizeOutput($a, $b, $c)
 {
     $obj = new _Utils();
     $this->string($obj->colorizeOutput($a, $b))->isEqualTo($c);
 }