Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mattab committed Feb 7, 2013
1 parent cf6565f commit de38e1c
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions tests/PHPUnit/bootstrap.php
Expand Up @@ -39,8 +39,22 @@


// General requirement checks & help: a webserver must be running for tests to work!
$hasConfigBeenUpdated = $_SERVER['REQUEST_URI'] != '@REQUEST_URI@';
if($hasConfigBeenUpdated) {
checkPiwikSetupForTests();

function checkPiwikSetupForTests()
{
if($_SERVER['REQUEST_URI'] == '@REQUEST_URI@') {
echo "WARNING: for tests to pass, you must first:
1) Install webserver on localhost, eg. apache
2) Make these Piwik files available on the webserver, at eg. http://localhost/dev/piwik/ - Piwik does need to be installed to run tests, but this URL must work.
3) Copy phpunit.xml.dist to phpunit.xml
4) Edit in phpunit.xml the @REQUEST_URI@ and replace with the webserver path to Piwik, eg. '/dev/piwik/'
Try again and now the tests should run!";
exit();
}

// Now testing if the webserver is running
$piwikServerUrl = IntegrationTestCase::getRootUrl();
try {
$fetched = Piwik_Http::sendHttpRequest($piwikServerUrl, $timeout = 3);
Expand All @@ -53,14 +67,4 @@
echo "\nPiwik should be running at: " . $piwikServerUrl . "\nbut this URL returned an unexpected response: '". $fetched . "'\n\n";
exit;
}
}
if(!$hasConfigBeenUpdated) {
echo "WARNING: for tests to pass, you must first:
1) Install webserver on localhost, eg. apache
2) Make these Piwik files available on the webserver, at eg. http://localhost/dev/piwik/ - Piwik does need to be installed to run tests, but this URL must work.
3) Copy phpunit.xml.dist to phpunit.xml
4) Edit in phpunit.xml the @REQUEST_URI@ and replace with the webserver path to Piwik, eg. '/dev/piwik/'
Try again and now the tests should run!";
exit();
}
}

0 comments on commit de38e1c

Please sign in to comment.