Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordiosmosis <benaka@piwik.pro>2015-06-16 07:05:07 +0300
committerdiosmosis <benaka@piwik.pro>2015-06-16 07:12:28 +0300
commitcf2694bca2e55ea8f1fd3df7725cd97c9c3468ad (patch)
tree6af57b2c465010cb54957df24ffa3030efb4096d /tests/PHPUnit/System/ArchiveCronTest.php
parent86a74fafaa425ba06dacc8fa33992338969e902a (diff)
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.
Diffstat (limited to 'tests/PHPUnit/System/ArchiveCronTest.php')
-rw-r--r--tests/PHPUnit/System/ArchiveCronTest.php22
1 files changed, 19 insertions, 3 deletions
diff --git a/tests/PHPUnit/System/ArchiveCronTest.php b/tests/PHPUnit/System/ArchiveCronTest.php
index 9c8be19798..db722f9266 100644
--- a/tests/PHPUnit/System/ArchiveCronTest.php
+++ b/tests/PHPUnit/System/ArchiveCronTest.php
@@ -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()
{
$periodTypes = array('day', 'periods');
@@ -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';
// 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
exec($cmd, $output, $result);