Skip to content
Extraits de code Groupes Projets
Valider cf2694bc rédigé par diosmosis's avatar diosmosis
Parcourir les fichiers

Fixes #7900, add test for this problem (Common not being available at the...

Fixes #7900, add test for this problem (Common not being available at the start of the script) in ArchiveCronTest.php by executing the real archive.php w/ the --help option.
parent 86a74faf
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -105,6 +105,15 @@ class ArchiveCronTest extends SystemTestCase ...@@ -105,6 +105,15 @@ class ArchiveCronTest extends SystemTestCase
} }
} }
public function test_archivePhpScript_DoesNotFail_WhenCommandHelpRequested()
{
$output = $this->runArchivePhpCron(array('--help' => null), PIWIK_INCLUDE_PATH . '/misc/cron/archive.php');
$output = implode("\n", $output);
$this->assertRegExp('/Usage:\s*core:archive/', $output);
$this->assertNotContains("Starting Piwik reports archiving...", $output);
}
private function setLastRunArchiveOptions() private function setLastRunArchiveOptions()
{ {
$periodTypes = array('day', 'periods'); $periodTypes = array('day', 'periods');
...@@ -123,13 +132,20 @@ class ArchiveCronTest extends SystemTestCase ...@@ -123,13 +132,20 @@ class ArchiveCronTest extends SystemTestCase
} }
} }
private function runArchivePhpCron() private function runArchivePhpCron($options = array(), $archivePhpScript = false)
{ {
$archivePhpScript = PIWIK_INCLUDE_PATH . '/tests/PHPUnit/proxy/archive.php'; $archivePhpScript = $archivePhpScript ?: PIWIK_INCLUDE_PATH . '/tests/PHPUnit/proxy/archive.php';
$urlToProxy = Fixture::getRootUrl() . 'tests/PHPUnit/proxy/index.php'; $urlToProxy = Fixture::getRootUrl() . 'tests/PHPUnit/proxy/index.php';
// create the command // create the command
$cmd = "php \"$archivePhpScript\" --url=\"$urlToProxy\" 2>&1"; $cmd = "php \"$archivePhpScript\" --url=\"$urlToProxy\"";
foreach ($options as $name => $value) {
$cmd .= " $name";
if ($value !== null) {
$cmd .= "=" . escapeshellarg($value);
}
}
$cmd .= " 2>&1";
// run the command // run the command
exec($cmd, $output, $result); exec($cmd, $output, $result);
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter