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>2014-10-27 03:54:12 +0300
committerdiosmosis <benaka@piwik.pro>2014-10-27 03:55:03 +0300
commitf4dbc61263d401a003c300847af19cf4b1f5db13 (patch)
tree4a2df46777d7a784f7064bad66dacf3f42b1f057 /tests/PHPUnit/System/ArchiveWebTest.php
parentc02da3ff183c18cb9e01c769ce74dfea95c9e261 (diff)
Refs #6513, make sure archive.php can be run w/ php-cgi (remove regression that caused it to fail) and add system test to catch future regressions, if any.
Diffstat (limited to 'tests/PHPUnit/System/ArchiveWebTest.php')
-rw-r--r--tests/PHPUnit/System/ArchiveWebTest.php30
1 files changed, 27 insertions, 3 deletions
diff --git a/tests/PHPUnit/System/ArchiveWebTest.php b/tests/PHPUnit/System/ArchiveWebTest.php
index bffa18b44f..592daae422 100644
--- a/tests/PHPUnit/System/ArchiveWebTest.php
+++ b/tests/PHPUnit/System/ArchiveWebTest.php
@@ -53,12 +53,18 @@ class ArchiveWebTest extends SystemTestCase
Option::delete('piwikUrl');
}
- $this->assertContains('Starting Piwik reports archiving...', $output);
- $this->assertContains('Archived website id = 1', $output);
- $this->assertContains('Done archiving!', $output);
+ $this->assertWebArchivingDone($output);
$this->compareArchivePhpOutputAgainstExpected($output);
}
+ public function test_WebArchiveScriptCanBeRun_WithPhpCgi_AndWithoutTokenAuth()
+ {
+ list($returnCode, $output) = $this->runArchivePhpScriptWithPhpCgi();
+
+ $this->assertEquals(0, $returnCode);
+ $this->assertWebArchivingDone($output);
+ }
+
private function compareArchivePhpOutputAgainstExpected($output)
{
$fileName = 'test_ArchiveCronTest_archive_php_cron_output.txt';
@@ -73,6 +79,24 @@ class ArchiveWebTest extends SystemTestCase
$this->comparisonFailures[] = $ex;
}
}
+
+ private function assertWebArchivingDone($output)
+ {
+ $this->assertContains('Starting Piwik reports archiving...', $output);
+ $this->assertContains('Archived website id = 1', $output);
+ $this->assertContains('Done archiving!', $output);
+ }
+
+ private function runArchivePhpScriptWithPhpCgi()
+ {
+ $command = "php-cgi \"" . PIWIK_INCLUDE_PATH . "/tests/PHPUnit/proxy/archive.php" . "\"";
+
+ exec($command, $output, $returnCode);
+
+ $output = implode("\n", $output);
+
+ return array($returnCode, $output);
+ }
}
ArchiveWebTest::$fixture = new ManySitesImportedLogs();