save_run($xhprofData, $profilerNamespace); echo "\n\nPROFILER RUN URL: /tests/lib/xhprof-0.9.2/xhprof_html/?source=$profilerNamespace&run=$runId\n\n"; }); } require_once PIWIK_INCLUDE_PATH . '/libs/upgradephp/upgrade.php'; require_once PIWIK_INCLUDE_PATH . '/core/testMinimumPhpVersion.php'; require_once PIWIK_INCLUDE_PATH . '/core/Loader.php'; require_once PIWIK_INCLUDE_PATH . '/core/functions.php'; require_once PIWIK_INCLUDE_PATH . '/core/FrontController.php'; require_once PIWIK_INCLUDE_PATH . '/libs/spyc.php'; require_once PIWIK_INCLUDE_PATH . '/tests/PHPUnit/DatabaseTestCase.php'; require_once PIWIK_INCLUDE_PATH . '/tests/PHPUnit/IntegrationTestCase.php'; require_once PIWIK_INCLUDE_PATH . '/tests/PHPUnit/UITest.php'; require_once PIWIK_INCLUDE_PATH . '/tests/PHPUnit/FakeAccess.php'; require_once PIWIK_INCLUDE_PATH . '/tests/PHPUnit/MockPiwikOption.php'; require_once PIWIK_INCLUDE_PATH . '/vendor/autoload.php'; // require test fixtures require_once PIWIK_INCLUDE_PATH . '/tests/PHPUnit/BaseFixture.php'; foreach (glob(PIWIK_INCLUDE_PATH . '/tests/PHPUnit/Fixtures/*.php') as $file) { require_once $file; } // General requirement checks & help: a webserver must be running for tests to work! checkPiwikSetupForTests(); function checkPiwikSetupForTests() { if (empty($_SERVER['REQUEST_URI']) || $_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. -> If you still get this message, you can work around it by specifying Host + Request_Uri at the top of this file tests/PHPUnit/bootstrap.php. <-"; exit(1); } // Now testing if the webserver is running $piwikServerUrl = Test_Piwik_BaseFixture::getRootUrl(); try { $fetched = Http::sendHttpRequest($piwikServerUrl, $timeout = 3); } catch (Exception $e) { $fetched = "ERROR fetching: " . $e->getMessage(); } $expectedString = 'plugins/CoreHome/images/favicon.ico'; if (strpos($fetched, $expectedString) === false) { echo "\nPiwik should be running at: " . $piwikServerUrl . "\nbut this URL returned an unexpected response: '" . $fetched . "...'\n\n"; exit(1); } }