Error when running tests on localhost install

I have a new local install. It appears to be functioning correctly aside from me being unable to run the tests successfully. I installed Matomo by cloning the git repo then using the Matomo Installation Welcome Screen to walk through the installation process.

./console tests:run results in the following

Executing command: cd /var/www/html/matomo/tests/PHPUnit &&  /var/www/html/matomo/vendor/bin/phpunit   --testsuite UnitTests
sh: 1: /var/www/html/matomo/vendor/bin/phpunit: not found

Executing command: cd /var/www/html/matomo/tests/PHPUnit &&  /var/www/html/matomo/vendor/bin/phpunit   --testsuite IntegrationTests
sh: 1: /var/www/html/matomo/vendor/bin/phpunit: not found

Executing command: cd /var/www/html/matomo/tests/PHPUnit &&  /var/www/html/matomo/vendor/bin/phpunit   --testsuite SystemTests
sh: 1: /var/www/html/matomo/vendor/bin/phpunit: not found

Executing command: cd /var/www/html/matomo/tests/PHPUnit &&  /var/www/html/matomo/vendor/bin/phpunit   --testsuite PluginTests
sh: 1: /var/www/html/matomo/vendor/bin/phpunit: not found

vendor/bin contains ‘lessc’ but nothing else.

I had the thought that ‘composer install’ might help however that results in this error.

In ArrayLoader.php line 44:
                                                                                                                                                
  Unknown package has no name defined ([{"name":"composer\/ca-bundle","version":"1.2.8","version_normalized":"1.2.8.0","source":{"type":"git",  
  "url":"https:\/\/github.com\/composer\/ca-bundle.git","reference":"8a7ecad675253e4654ea055052332853....

That error output goes on much longer.

I do have phpunit already available on this machine however the test runner appears to require phpunit to exist at vendor/bin specifically. Any tips would be greatly appreciated. I suspect I am probably missing something obvious.

Hi,

Which version of composer are you using?
For me it is working if I do a fresh install:

➜  ~/tmp git clone https://github.com/matomo-org/matomo.git
Klone nach 'matomo' ...
remote: Enumerating objects: 130, done.
remote: Counting objects: 100% (130/130), done.
remote: Compressing objects: 100% (107/107), done.
remote: Total 331336 (delta 39), reused 46 (delta 21), pack-reused 331206
Empfange Objekte: 100% (331336/331336), 220.19 MiB | 5.98 MiB/s, fertig.
Löse Unterschiede auf: 100% (239168/239168), fertig.
➜  ~/tmp cd matomo 
➜  ~/tmp/matomo git:(4.x-dev) composer --version
Composer 2.0.9 2021-01-27 16:09:27
➜  ~/tmp/matomo git:(4.x-dev) composer install
> Piwik\Composer\ScriptHandler::cleanXhprof
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Package operations: 75 installs, 0 updates, 0 removals
  - Syncing lox/xhprof (dev-master c64571f) into cache
  - Downloading matomo/matomo-php-tracker (3.0.0)
  - Downloading tedivm/jshrink (v1.4.0)
  - Installing squizlabs/php_codesniffer (3.5.8): Extracting archive
  - Installing dealerdirect/phpcodesniffer-composer-installer (v0.7.0): Extracting archive
  - Installing composer/semver (1.3.0): Extracting archive
  - Installing davaxi/sparkline (1.2.2): Extracting archive
  - Installing composer/ca-bundle (1.2.8): Extracting archive
  - Installing maxmind/web-service-common (v0.8.1): Extracting archive
  - Installing maxmind-db/reader (v1.8.0): Extracting archive
  - Installing geoip2/geoip2 (v2.11.0): Extracting archive
  - Installing lox/xhprof (dev-master c64571f): Cloning c64571f892 from cache
  - Installing doctrine/cache (1.10.2): Extracting archive
  - Installing matomo/cache (2.0.2): Extracting archive
  - Installing pear/pear_exception (v1.0.1): Extracting archive
  - Installing pear/console_getopt (v1.4.3): Extracting archive
  - Installing pear/pear-core-minimal (v1.10.10): Extracting archive
  - Installing pear/archive_tar (1.4.11): Extracting archive
  - Installing matomo/decompress (2.1.0): Extracting archive
  - Installing mustangostang/spyc (0.6.3): Extracting archive
  - Installing matomo/device-detector (4.1.0): Extracting archive
  - Installing matomo/ini (2.0.2): Extracting archive
  - Installing matomo/matomo-php-tracker (3.0.0): Extracting archive
  - Installing matomo/network (2.0.1): Extracting archive
  - Installing matomo/referrer-spam-list (4.0.0): Extracting archive
  - Installing matomo/searchengine-and-social-list (3.11.0): Extracting archive
  - Installing phpstan/phpdoc-parser (0.4.9): Extracting archive
  - Installing slevomat/coding-standard (6.4.1): Extracting archive
  - Installing escapestudios/symfony2-coding-standard (3.11.0): Extracting archive
  - Installing mayflower/mo4-coding-standard (v6.0.0): Extracting archive
  - Installing psr/container (1.0.0): Extracting archive
  - Installing php-di/phpdoc-reader (2.2.1): Extracting archive
  - Installing php-di/invoker (2.0.0): Extracting archive
  - Installing opis/closure (3.6.1): Extracting archive
  - Installing php-di/php-di (6.3.0): Extracting archive
  - Installing symfony/polyfill-ctype (v1.20.0): Extracting archive
  - Installing webmozart/assert (1.9.1): Extracting archive
  - Installing phpdocumentor/reflection-common (2.2.0): Extracting archive
  - Installing phpdocumentor/type-resolver (1.4.0): Extracting archive
  - Installing phpdocumentor/reflection-docblock (5.2.2): Extracting archive
  - Installing phpmailer/phpmailer (v6.1.8): Extracting archive
  - Installing phpunit/php-token-stream (3.1.1): Extracting archive
  - Installing sebastian/version (2.0.1): Extracting archive
  - Installing sebastian/type (1.1.3): Extracting archive
  - Installing sebastian/resource-operations (2.0.1): Extracting archive
  - Installing sebastian/recursion-context (3.0.0): Extracting archive
  - Installing sebastian/object-reflector (1.1.1): Extracting archive
  - Installing sebastian/object-enumerator (3.0.3): Extracting archive
  - Installing sebastian/global-state (3.0.0): Extracting archive
  - Installing sebastian/exporter (3.1.2): Extracting archive
  - Installing sebastian/environment (4.2.3): Extracting archive
  - Installing sebastian/diff (3.0.2): Extracting archive
  - Installing sebastian/comparator (3.0.2): Extracting archive
  - Installing phpunit/php-timer (2.1.2): Extracting archive
  - Installing phpunit/php-text-template (1.2.1): Extracting archive
  - Installing phpunit/php-file-iterator (2.0.2): Extracting archive
  - Installing theseer/tokenizer (1.2.0): Extracting archive
  - Installing sebastian/code-unit-reverse-lookup (1.0.1): Extracting archive
  - Installing phpunit/php-code-coverage (7.0.10): Extracting archive
  - Installing doctrine/instantiator (1.4.0): Extracting archive
  - Installing phpspec/prophecy (1.12.1): Extracting archive
  - Installing phar-io/version (2.0.1): Extracting archive
  - Installing phar-io/manifest (1.0.3): Extracting archive
  - Installing myclabs/deep-copy (1.10.2): Extracting archive
  - Installing phpunit/phpunit (8.5.9): Extracting archive
  - Installing psr/log (1.1.3): Extracting archive
  - Installing symfony/console (v2.6.13): Extracting archive
  - Installing symfony/event-dispatcher (v2.6.13): Extracting archive
  - Installing monolog/monolog (1.25.5): Extracting archive
  - Installing symfony/monolog-bridge (v2.6.13): Extracting archive
  - Installing symfony/var-dumper (v2.6.13): Extracting archive
  - Installing symfony/yaml (v2.6.13): Extracting archive
  - Installing szymach/c-pchart (v2.0.12): Extracting archive
  - Installing tecnickcom/tcpdf (6.3.5): Extracting archive
  - Installing tedivm/jshrink (v1.4.0): Extracting archive
  - Installing symfony/polyfill-mbstring (v1.20.0): Extracting archive
  - Installing twig/twig (v3.1.1): Extracting archive
  - Installing wikimedia/less.php (v3.1.0): Extracting archive
Package phpunit/php-token-stream is abandoned, you should avoid using it. No replacement was suggested.
Generating autoload files
14 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
PHP CodeSniffer Config installed_paths set to ../../slevomat/coding-standard,../../escapestudios/symfony2-coding-standard,../../mayflower/mo4-coding-standard
> Piwik\Composer\ScriptHandler::buildXhprof
➜  ~/tmp/matomo git:(4.x-dev) ls vendor/bin/phpunit -l
lrwxrwxrwx 26 lukas  7 Feb 16:36 vendor/bin/phpunit -> ../phpunit/phpunit/phpunit

Great question. It turns out I was using a rather dated version of Composer
Composer 1.6.3 2018-01-31 16:28:17

After installing Composer version 2.0.9 2021-01-27 16:09:27 I can now install the dependencies. Thank you for the help :slight_smile:

Unfortunately that has just moved me on to a new problem.

PHP Fatal error:  Uncaught PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'matomo_tests.option' doesn't exist in /var/www/html/matomo/libs/Zend/Db/Statement/Pdo.php:233

I haven’t had time to do more than a cursory google to see what is going on there. I will hopefully get time to dig into it a bit more in a few hours but if the solution to that happens to be immediately apparent let me know :slight_smile:

1 Like

I now have the tests running. I didnt have request_uri set correctly in config/global.ini.php.

1 Like