Skip to content
Extraits de code Groupes Projets
Valider 562c7579 rédigé par mattab's avatar mattab
Parcourir les fichiers

Simplify test code

parent 235ab936
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -74,28 +74,15 @@ class Test_Piwik_Integration_ArchiveCronTest extends IntegrationTestCase ...@@ -74,28 +74,15 @@ class Test_Piwik_Integration_ArchiveCronTest extends IntegrationTestCase
return $results; return $results;
} }
public function getArchivePhpCronOptionsToTest()
{
return array(
array('noOptions', array()),
// segment archiving makes calling the script more than once impractical. if all 4 are
// called, this test can take up to 13min to complete.
/*array('forceAllWebsites', array('--force-all-websites' => false)),
array('forceAllPeriods_lastDay', array('--force-all-periods' => '86400')),
array('forceAllPeriods_allTime', array('--force-all-periods' => false)),*/
);
}
/** /**
* @dataProvider getArchivePhpCronOptionsToTest
* @group Integration * @group Integration
*/ */
public function testArchivePhpCron($optionGroupName, $archivePhpOptions) public function testArchivePhpCron()
{ {
self::deleteArchiveTables(); self::deleteArchiveTables();
$this->setLastRunArchiveOptions(); $this->setLastRunArchiveOptions();
$output = $this->runArchivePhpCron($archivePhpOptions); $output = $this->runArchivePhpCron();
foreach ($this->getApiForTesting() as $testInfo) { foreach ($this->getApiForTesting() as $testInfo) {
...@@ -104,7 +91,7 @@ class Test_Piwik_Integration_ArchiveCronTest extends IntegrationTestCase ...@@ -104,7 +91,7 @@ class Test_Piwik_Integration_ArchiveCronTest extends IntegrationTestCase
if (!isset($params['testSuffix'])) { if (!isset($params['testSuffix'])) {
$params['testSuffix'] = ''; $params['testSuffix'] = '';
} }
$params['testSuffix'] .= '_' . $optionGroupName; $params['testSuffix'] .= '_noOptions';
$params['disableArchiving'] = true; $params['disableArchiving'] = true;
$success = $this->runApiTests($api, $params); $success = $this->runApiTests($api, $params);
...@@ -133,21 +120,13 @@ class Test_Piwik_Integration_ArchiveCronTest extends IntegrationTestCase ...@@ -133,21 +120,13 @@ class Test_Piwik_Integration_ArchiveCronTest extends IntegrationTestCase
} }
} }
private function runArchivePhpCron($options) private function runArchivePhpCron()
{ {
$archivePhpScript = PIWIK_INCLUDE_PATH . '/tests/PHPUnit/proxy/archive.php'; $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\" "; $cmd = "php \"$archivePhpScript\" --url=\"$urlToProxy\" 2>&1";
foreach ($options as $name => $value) {
$cmd .= $name;
if ($value !== false) {
$cmd .= '="' . $value . '"';
}
$cmd .= ' ';
}
$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