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:
authorsgiehl <stefan@piwik.org>2014-11-13 00:09:37 +0300
committersgiehl <stefan@piwik.org>2014-11-13 00:09:37 +0300
commita45c6b956f1828a1a9a209a7bd72a6816e907de7 (patch)
treecd164195632271d33b34228d6a9285f9d2658d58
parent6ffcf24a80a08913012453a9b8ce3315206faeb9 (diff)
parent03d40b9fe7ba5f8b9637edc8d83bf33503086793 (diff)
Merge branch 'master' into deprecate_usersettings
-rw-r--r--CHANGELOG.md1
-rw-r--r--config/global.ini.php7
-rwxr-xr-xcore/DataTable/Filter/GroupBy.php2
-rw-r--r--plugins/CoreConsole/Commands/GenerateArchiver.php59
-rw-r--r--plugins/ExamplePlugin/Archiver.php65
-rw-r--r--plugins/Provider/API.php5
-rw-r--r--plugins/TestRunner/Aws/CloudWatch.php25
-rw-r--r--plugins/TestRunner/Aws/Instance.php22
-rw-r--r--plugins/TestRunner/Aws/config.ini.php3
-rw-r--r--plugins/TestRunner/Commands/TestsRun.php34
-rw-r--r--plugins/TestRunner/Runner/Remote.php2
-rw-r--r--tests/PHPUnit/bootstrap.php39
-rw-r--r--tests/PHPUnit/config.ini.travis.php3
-rw-r--r--tests/PHPUnit/phpunit.xml.dist11
-rw-r--r--tests/README.md29
-rwxr-xr-xtests/travis/prepare.sh1
16 files changed, 238 insertions, 70 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 03ea44224a..4d13393ba4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,7 @@ This is a changelog for Piwik platform developers. All changes for our HTTP API'
### Deprecations
* Most methods of `Piwik\IP` have been deprecated in favor of the new [piwik/network](https://github.com/piwik/component-network) component.
+* The file `tests/PHPUnit/phpunit.xml` is no longer needed in order to run tests and we suggest to delete it. The test configuration is now done automatically if possible. In case the tests do no longer work check out the `[tests]` section in `config/global.ini.php`
### Library updates
* Code for manipulating IP addresses has been moved to a separate standalone component: [piwik/network](https://github.com/piwik/component-network). Backward compatibility is kept in Piwik core.
diff --git a/config/global.ini.php b/config/global.ini.php
index 8abd6c5225..516497ada1 100644
--- a/config/global.ini.php
+++ b/config/global.ini.php
@@ -39,6 +39,13 @@ type = InnoDB
schema = Mysql
[tests]
+; needed in order to run tests.
+; if Piwik is available at http://localhost/dev/piwik/ replace @REQUEST_URI@ with /dev/piwik/
+; note: the REQUEST_URI should not contain "plugins" or "tests" in the PATH
+http_host = localhost
+remote_addr = "127.0.0.1"
+request_uri = "@REQUEST_URI@"
+
; access key and secret as listed in AWS -> IAM -> Users
aws_accesskey = ""
aws_secret = ""
diff --git a/core/DataTable/Filter/GroupBy.php b/core/DataTable/Filter/GroupBy.php
index 9391ccd95f..2ac79a6de9 100755
--- a/core/DataTable/Filter/GroupBy.php
+++ b/core/DataTable/Filter/GroupBy.php
@@ -10,6 +10,7 @@ namespace Piwik\DataTable\Filter;
use Piwik\DataTable;
use Piwik\DataTable\BaseFilter;
+use Piwik\DataTable\Row;
/**
* DataTable filter that will group {@link DataTable} rows together based on the results
@@ -71,6 +72,7 @@ class GroupBy extends BaseFilter
*/
public function filter($table)
{
+ /** @var Row[] $groupByRows */
$groupByRows = array();
$nonGroupByRowIds = array();
diff --git a/plugins/CoreConsole/Commands/GenerateArchiver.php b/plugins/CoreConsole/Commands/GenerateArchiver.php
new file mode 100644
index 0000000000..bbbdb85dfc
--- /dev/null
+++ b/plugins/CoreConsole/Commands/GenerateArchiver.php
@@ -0,0 +1,59 @@
+<?php
+/**
+ * Piwik - free/libre analytics platform
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ *
+ */
+
+namespace Piwik\Plugins\CoreConsole\Commands;
+
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Input\InputOption;
+use Symfony\Component\Console\Output\OutputInterface;
+
+/**
+ */
+class GenerateArchiver extends GeneratePluginBase
+{
+ protected function configure()
+ {
+ $this->setName('generate:archiver')
+ ->setDescription('Adds an Archiver to an existing plugin')
+ ->addOption('pluginname', null, InputOption::VALUE_REQUIRED, 'The name of an existing plugin which does not have an Archiver yet');
+ }
+
+ protected function execute(InputInterface $input, OutputInterface $output)
+ {
+ $pluginName = $this->getPluginName($input, $output);
+ $this->checkAndUpdateRequiredPiwikVersion($pluginName, $output);
+
+ $exampleFolder = PIWIK_INCLUDE_PATH . '/plugins/ExamplePlugin';
+ $replace = array('ExamplePlugin' => ucfirst($pluginName), 'EXAMPLEPLUGIN' => strtoupper($pluginName));
+ $whitelistFiles = array('/Archiver.php');
+
+ $this->copyTemplateToPlugin($exampleFolder, $pluginName, $replace, $whitelistFiles);
+
+ $this->writeSuccessMessage($output, array(
+ sprintf('Archiver.php for %s generated.', $pluginName),
+ 'You can now start implementing Archiver methods',
+ 'Enjoy!'
+ ));
+ }
+
+ /**
+ * @param InputInterface $input
+ * @param OutputInterface $output
+ * @return array
+ * @throws \RuntimeException
+ */
+ protected function getPluginName(InputInterface $input, OutputInterface $output)
+ {
+ $pluginNames = $this->getPluginNamesHavingNotSpecificFile('Archiver.php');
+ $invalidName = 'You have to enter the name of an existing plugin which does not already have an Archiver';
+
+ return $this->askPluginNameAndValidate($input, $output, $pluginNames, $invalidName);
+ }
+
+}
diff --git a/plugins/ExamplePlugin/Archiver.php b/plugins/ExamplePlugin/Archiver.php
new file mode 100644
index 0000000000..a40ad2c97a
--- /dev/null
+++ b/plugins/ExamplePlugin/Archiver.php
@@ -0,0 +1,65 @@
+<?php
+/**
+ * Piwik - free/libre analytics platform
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ *
+ */
+
+namespace Piwik\Plugins\ExamplePlugin;
+
+/**
+ * Class Archiver
+ * @package Piwik\Plugins\ExamplePlugin
+ *
+ * Archiver is class processing raw data into ready ro read reports.
+ * It must implement two methods for aggregating daily reports
+ * aggregateDayReport() and other for summing daily reports into periods
+ * like week, month, year or custom range aggregateMultipleReports().
+ *
+ * For more detailed information about Archiver please visit Piwik developer guide
+ * http://developer.piwik.org/api-reference/Piwik/Plugin/Archiver
+ *
+ */
+class Archiver extends \Piwik\Plugin\Archiver
+{
+ /**
+ * It is a good practice to store your archive names (reports stored in database)
+ * in Archiver class constants. You can define as many record names as you want
+ * for your plugin.
+ *
+ * Also important thing is that record name must be prefixed with plugin name.
+ *
+ * This is only an example record name, so feel free to change it to suit your needs.
+ */
+ const EXAMPLEPLUGIN_ARCHIVE_RECORD = "ExamplePlugin_archive_record";
+
+ public function aggregateDayReport()
+ {
+ /**
+ * inside this method you can implement your LogAggreagator usage
+ * to process daily reports, this one uses idvisitor to group results.
+ *
+ * $visitorMetrics = $this
+ * ->getLogAggregator()
+ * ->getMetricsFromVisitByDimension('idvisitor')
+ * ->asDataTable();
+ * $visitorReport = $visitorMetrics->getSerialized();
+ * $this->getProcessor()->insertBlobRecord(self::EXAMPLEPLUGIN_ARCHIVE_RECORD, $visitorReport);
+ */
+ }
+
+ public function aggregateMultipleReports()
+ {
+ /**
+ * Inside this method you can simply point daily records
+ * to be summed. This work for most cases.
+ * However if needed, also custom queries can be implemented
+ * for periods to achieve more acurrate results.
+ *
+ * $this->getProcessor()->aggregateDataTableRecords(self::EXAMPLEPLUGIN_ARCHIVE_RECORD);
+ */
+ }
+
+}
diff --git a/plugins/Provider/API.php b/plugins/Provider/API.php
index c7e7cd11c8..bd4b5c6676 100644
--- a/plugins/Provider/API.php
+++ b/plugins/Provider/API.php
@@ -30,11 +30,10 @@ class API extends \Piwik\Plugin\API
$archive = Archive::build($idSite, $period, $date, $segment);
$dataTable = $archive->getDataTable(Archiver::PROVIDER_RECORD_NAME);
$dataTable->filter('Sort', array(Metrics::INDEX_NB_VISITS));
- $dataTable->queueFilter('ColumnCallbackAddMetadata', array('label', 'url', __NAMESPACE__ . '\getHostnameUrl'));
- $dataTable->queueFilter('ColumnCallbackReplace', array('label', __NAMESPACE__ . '\getPrettyProviderName'));
+ $dataTable->filter('ColumnCallbackAddMetadata', array('label', 'url', __NAMESPACE__ . '\getHostnameUrl'));
+ $dataTable->filter('GroupBy', array('label', __NAMESPACE__ . '\getPrettyProviderName'));
$dataTable->queueFilter('ReplaceColumnNames');
$dataTable->queueFilter('ReplaceSummaryRowLabel');
- $dataTable->queueFilter('GroupBy', array('label'));
return $dataTable;
}
}
diff --git a/plugins/TestRunner/Aws/CloudWatch.php b/plugins/TestRunner/Aws/CloudWatch.php
index 0748ac129f..0718157d69 100644
--- a/plugins/TestRunner/Aws/CloudWatch.php
+++ b/plugins/TestRunner/Aws/CloudWatch.php
@@ -21,16 +21,33 @@ class CloudWatch
*/
private $config;
+ /**
+ * @var CloudWatchClient
+ */
+ private $client;
+
public function __construct(Config $awsConfig)
{
$this->config = $awsConfig;
+ $this->client = $this->getCloudWatchClient();
}
- public function terminateInstanceIfIdleForTooLong($instanceIds)
+ public function hasAssignedAlarms($instanceIds)
{
- $client = $this->getCloudWatchClient();
+ $result = $this->client->describeAlarmsForMetric(array(
+ 'MetricName' => 'CPUUtilization',
+ 'Namespace' => $this->getNamespace(),
+ 'Dimensions' => $this->getDimensions($instanceIds)
+ ));
- $client->putMetricAlarm(array(
+ $metricAlarms = $result->getPath('MetricAlarms');
+
+ return !empty($metricAlarms);
+ }
+
+ public function terminateInstanceIfIdleForTooLong($instanceIds)
+ {
+ $this->client->putMetricAlarm(array(
'AlarmName' => 'TerminateInstanceBecauseIdle',
'AlarmDescription' => 'Terminate instances if CPU is on average < 10% for 5 minutes in a row 8 times consecutively',
'ActionsEnabled' => true,
@@ -48,7 +65,7 @@ class CloudWatch
'ComparisonOperator' => ComparisonOperator::LESS_THAN_THRESHOLD,
));
- $client->putMetricAlarm(array(
+ $this->client->putMetricAlarm(array(
'AlarmName' => 'TerminateInstanceIfStatusCheckFails',
'AlarmDescription' => 'Terminate instances in case two status check fail within one minute',
'ActionsEnabled' => true,
diff --git a/plugins/TestRunner/Aws/Instance.php b/plugins/TestRunner/Aws/Instance.php
index 622f7cf9bf..769b35b337 100644
--- a/plugins/TestRunner/Aws/Instance.php
+++ b/plugins/TestRunner/Aws/Instance.php
@@ -63,6 +63,9 @@ class Instance
if (!empty($reservations)) {
$host = $this->getHostFromDescribedInstances($instances);
+ $instanceIds = $instances->getPath('Reservations/*/Instances/*/InstanceId');
+ $this->verifySetup($instanceIds);
+
return $host;
}
}
@@ -96,15 +99,15 @@ class Instance
$instanceIds = $result->getPath('Instances/*/InstanceId');
+ $this->client->waitUntilInstanceRunning(array(
+ 'InstanceIds' => $instanceIds,
+ ));
+
return $instanceIds;
}
public function setup($instanceIds)
{
- $this->client->waitUntilInstanceRunning(array(
- 'InstanceIds' => $instanceIds,
- ));
-
$awsCloudWatch = new CloudWatch($this->config);
$awsCloudWatch->terminateInstanceIfIdleForTooLong($instanceIds);
@@ -120,6 +123,17 @@ class Instance
return $host;
}
+ public function verifySetup($instanceIds)
+ {
+ $awsCloudWatch = new CloudWatch($this->config);
+ $hasAlarms = $awsCloudWatch->hasAssignedAlarms($instanceIds);
+
+ if (!$hasAlarms) {
+ return $this->setup($instanceIds);
+ }
+
+ }
+
/**
* @param \Guzzle\Service\Resource\Model $resources
* @return mixed
diff --git a/plugins/TestRunner/Aws/config.ini.php b/plugins/TestRunner/Aws/config.ini.php
index 89f6bb0ee6..a6111e5685 100644
--- a/plugins/TestRunner/Aws/config.ini.php
+++ b/plugins/TestRunner/Aws/config.ini.php
@@ -8,6 +8,9 @@ dbname = "piwik"
tables_prefix = "piwik_"
charset = "utf8"
+[tests]
+request_uri = "/"
+
[database_tests]
password = "secure"
tables_prefix = ""
diff --git a/plugins/TestRunner/Commands/TestsRun.php b/plugins/TestRunner/Commands/TestsRun.php
index 5e9e762817..0aaef90049 100644
--- a/plugins/TestRunner/Commands/TestsRun.php
+++ b/plugins/TestRunner/Commands/TestsRun.php
@@ -28,7 +28,7 @@ class TestsRun extends ConsoleCommand
{
$this->setName('tests:run');
$this->setDescription('Run Piwik PHPUnit tests one testsuite after the other');
- $this->addArgument('magic', InputArgument::OPTIONAL, 'Eg a path to a file or directory, the name of a testsuite, the name of a plugin, ... We will try to detect what you meant.', '');
+ $this->addArgument('variables', InputArgument::IS_ARRAY, 'Eg a path to a file or directory, the name of a testsuite, the name of a plugin, ... We will try to detect what you meant. You can define multiple values', array());
$this->addOption('options', 'o', InputOption::VALUE_OPTIONAL, 'All options will be forwarded to phpunit', '');
$this->addOption('xhprof', null, InputOption::VALUE_NONE, 'Profile using xhprof.');
$this->addOption('group', null, InputOption::VALUE_REQUIRED, 'Run only a specific test group. Separate multiple groups by comma, for instance core,plugins', '');
@@ -40,7 +40,7 @@ class TestsRun extends ConsoleCommand
{
$options = $input->getOption('options');
$groups = $input->getOption('group');
- $magic = $input->getArgument('magic');
+ $magics = $input->getArgument('variables');
$groups = $this->getGroupsFromString($groups);
@@ -88,15 +88,23 @@ class TestsRun extends ConsoleCommand
$suite = $this->getTestsuite($input);
$testFile = $this->getTestFile($input);
- if (!empty($magic)) {
- if (empty($suite) && (in_array($magic, $this->getTestsSuites()) || in_array($magic, array('plugin', 'core')))) {
- $suite = $this->buildTestSuiteName($magic);
- } elseif (empty($testFile) && file_exists($magic)) {
- $testFile = $this->fixPathToTestFileOrDirectory($magic);
- } elseif (empty($testFile) && $this->getPluginTestFolderName($magic)) {
- $testFile = $this->getPluginTestFolderName($magic);
- } elseif (empty($groups)) {
- $groups = $this->getGroupsFromString($magic);
+ if (!empty($magics)) {
+ foreach ($magics as $magic) {
+ if (empty($suite) && (in_array($magic, $this->getTestsSuites()))) {
+ $suite = $this->buildTestSuiteName($magic);
+ } elseif (empty($testFile) && 'core' === $magic) {
+ $testFile = $this->fixPathToTestFileOrDirectory('tests/PHPUnit');
+ } elseif (empty($testFile) && 'plugins' === $magic) {
+ $testFile = $this->fixPathToTestFileOrDirectory('plugins');
+ } elseif (empty($testFile) && file_exists($magic)) {
+ $testFile = $this->fixPathToTestFileOrDirectory($magic);
+ } elseif (empty($testFile) && $this->getPluginTestFolderName($magic)) {
+ $testFile = $this->getPluginTestFolderName($magic);
+ } elseif (empty($groups)) {
+ $groups = $this->getGroupsFromString($magic);
+ } else {
+ $groups[] = $magic;
+ }
}
}
@@ -159,7 +167,7 @@ class TestsRun extends ConsoleCommand
$params = $this->buildPhpUnitCliParams($suite, $groups, $options);
if (!empty($testFile)) {
- $params .= $params . " " . $testFile;
+ $params = $params . " " . $testFile;
}
$this->executeTestRun($command, $params, $output);
@@ -264,4 +272,4 @@ class TestsRun extends ConsoleCommand
return $groups;
}
-} \ No newline at end of file
+}
diff --git a/plugins/TestRunner/Runner/Remote.php b/plugins/TestRunner/Runner/Remote.php
index 49127c45f9..c0a5c5d8e1 100644
--- a/plugins/TestRunner/Runner/Remote.php
+++ b/plugins/TestRunner/Runner/Remote.php
@@ -64,8 +64,6 @@ class Remote
private function prepareTestRun($host)
{
- $this->ssh->exec('cp ./tests/PHPUnit/phpunit.xml.dist ./tests/PHPUnit/phpunit.xml');
- $this->ssh->exec("sed -i 's/@REQUEST_URI@/\\//g' ./tests/PHPUnit/phpunit.xml");
$this->ssh->exec("sed -i 's/amazonAwsUrl/$host/g' ./config/config.ini.php");
}
diff --git a/tests/PHPUnit/bootstrap.php b/tests/PHPUnit/bootstrap.php
index bdd1b3a771..a8d71efb38 100644
--- a/tests/PHPUnit/bootstrap.php
+++ b/tests/PHPUnit/bootstrap.php
@@ -1,4 +1,5 @@
<?php
+
define('PIWIK_TEST_MODE', true);
define('PIWIK_PRINT_ERROR_BACKTRACE', false);
@@ -55,12 +56,34 @@ foreach($fixturesToLoad as $fixturePath) {
}
}
+function prepareServerVariables()
+{
+ \Piwik\Config::getInstance()->init();
+ $testConfig = \Piwik\Config::getInstance()->tests;
+
+ if ('@REQUEST_URI@' === $testConfig['request_uri']) {
+ // config not done yet, if Piwik is installed we can automatically configure request_uri and http_host
+ $url = \Piwik\SettingsPiwik::getPiwikUrl();
+
+ if (!empty($url)) {
+ $parsedUrl = parse_url($url);
+ $testConfig['request_uri'] = $parsedUrl['path'];
+ $testConfig['http_host'] = $parsedUrl['host'];
+ \Piwik\Config::getInstance()->tests = $testConfig;
+ \Piwik\Config::getInstance()->forceSave();
+ }
+ }
+
+ $_SERVER['HTTP_HOST'] = $testConfig['http_host'];
+ $_SERVER['REQUEST_URI'] = $testConfig['request_uri'];
+ $_SERVER['REMOTE_ADDR'] = $testConfig['remote_addr'];
+}
+
+prepareServerVariables();
+
// General requirement checks & help: a webserver must be running for tests to work if not running UnitTests!
if (empty($_SERVER['argv']) || !in_array('UnitTests', $_SERVER['argv'])) {
checkPiwikSetupForTests();
-} else {
- // To prevent a weird bug
- Piwik\Config::getInstance()->init();
}
function checkPiwikSetupForTests()
@@ -72,11 +95,13 @@ function checkPiwikSetupForTests()
1) Install webserver on localhost, eg. apache
2) Make these Piwik files available on the webserver, at eg. http://localhost/dev/piwik/
3) Install Piwik by going through the installation process
-4) Copy phpunit.xml.dist to phpunit.xml
-5) Edit in phpunit.xml the @REQUEST_URI@ and replace with the webserver path to Piwik, eg. '/dev/piwik/'
+4) Configure tests section if needed in config/config.ini.php:
+[tests]
+http_host = \"localhost\"
+request_uri = \"@REQUEST_URI@\"
+remote_addr = \"127.0.0.1\"
-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. <-";
+Try again.";
exit(1);
}
$baseUrl = \Piwik\Tests\Framework\Fixture::getRootUrl();
diff --git a/tests/PHPUnit/config.ini.travis.php b/tests/PHPUnit/config.ini.travis.php
index a4f171470b..8863d1d422 100644
--- a/tests/PHPUnit/config.ini.travis.php
+++ b/tests/PHPUnit/config.ini.travis.php
@@ -12,6 +12,9 @@ adapter = PDO\MYSQL
tables_prefix =
;charset = utf8
+[tests]
+request_uri = "/"
+
[database_tests]
host = localhost
username = root
diff --git a/tests/PHPUnit/phpunit.xml.dist b/tests/PHPUnit/phpunit.xml.dist
index 2a8179aee4..0a03dd9846 100644
--- a/tests/PHPUnit/phpunit.xml.dist
+++ b/tests/PHPUnit/phpunit.xml.dist
@@ -19,17 +19,6 @@
strict="false"
verbose="true">
-<php>
- <!--
- When copying this file to phpunit.xml, replace with the path to Piwik on localhost.
- If Piwik is available at http://localhost/dev/piwik/ replace @REQUEST_URI@ with /dev/piwik/
- NOTE: the REQUEST_URI should not contain "plugins" or "tests" in the PATH
- -->
- <server name="HTTP_HOST" value="localhost"/>
- <server name="REQUEST_URI" value="@REQUEST_URI@"/>
- <server name="REMOTE_ADDR" value="127.0.0.1"/>
-</php>
-
<testsuites>
<testsuite name="SystemTests">
<directory>./System</directory>
diff --git a/tests/README.md b/tests/README.md
index 208036406e..faf942cba4 100644
--- a/tests/README.md
+++ b/tests/README.md
@@ -42,34 +42,13 @@ To execute the tests:
## PHPUnit Tests
-1. To install PHPUnit, run `php composer.phar update` in the Piwik root directory.
+1. To install PHPUnit, run `php composer.phar install --dev` in the Piwik root directory.
- Add the PHPUnit binary path to the your PATH environment variable. For example on Linux:
- Edit `.bashrc` in your home directory and add the following line:
-
- export PATH=/path/to/dir:$PATH
-
- You will need to source your `.bashrc` or logout/login (or restart the terminal) for the changes to take effect.
- To source your `.bashrc`, in your home directory simply type
-
- $ source .bashrc
-
- See [PHPUnit doc](http://www.phpunit.de/manual/current/en/installation.html).
- Note: if you were already using PHPUnit using PEAR, you may delete the PEAR PHPUnit with `sudo rm /usr/bin/phpunit`
-
-2. Configure PHPUnit: Copy the file `piwik/tests/PHPUnit/phpunit.xml.dist` to `phpunit.xml`.
- In this file, you will find the following lines.
- Please edit HTTP_HOST and REQUEST_URI to match the hostname and path of the Piwik files.
- For example if your Piwik is available at http://localhost/path/to/piwik/ you would write:
-
- <server name="HTTP_HOST" value="localhost"/>
- <server name="REQUEST_URI" value="/path/to/piwik/"/>
-
-3. Ensure the `[database_tests]` section in `piwik/config/config.php.ini` is set up correctly,
+2. Ensure the `[database_tests]` section in `piwik/config/config.php.ini` is set up correctly,
i.e. with the correct password to prevent the following error:
`SQLSTATE[28000] [1045] Access denied for user 'root'@'localhost' (using password: NO)`
-4. Run the tests
+3. Run the tests
$ cd /path/to/piwik
$ ./console tests:run --testsuite unit
@@ -87,7 +66,7 @@ To execute the tests:
To execute multiple groups you can separate them via a comma:
`./console tests:run CustomAlerts,Insights`. This would run all unit, integration and system tests of the CustomAlerts and Insights plugin.
-5. Write more tests :)
+4. Write more tests :)
See ["Writing Unit tests with PHPUnit"](http://www.phpunit.de/manual/current/en/writing-tests-for-phpunit.html)
## How to differentiate between unit, integration or system tests?
diff --git a/tests/travis/prepare.sh b/tests/travis/prepare.sh
index b430f698ff..93531210ce 100755
--- a/tests/travis/prepare.sh
+++ b/tests/travis/prepare.sh
@@ -20,7 +20,6 @@ sed "s/PDO\\\MYSQL/${MYSQL_ADAPTER}/g" ./tests/PHPUnit/config.ini.travis.php > .
# Prepare phpunit.xml
echo "Adjusting phpunit.xml"
cp ./tests/PHPUnit/phpunit.xml.dist ./tests/PHPUnit/phpunit.xml
-sed -i 's/@REQUEST_URI@/\//g' ./tests/PHPUnit/phpunit.xml
if [ -n "$PLUGIN_NAME" ];
then