0

I'm trying to get the PHPUnit code coverage for a Laravel project with Scrutinizer.
But when I schedule an inspection the process block at this line of the config file.

mysql -uroot -e "CREATE DATABASE IF NOT EXISTS scrutinize"

And I keep getting this error.

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

This is the content of the .scrutinizer.yml configuration file.

filter:
    excluded_paths: 
        - "tests/"
        - "public/"
        - "resources/js/vendor/"
        - "database/"
    
    dependency_paths:
        - "vendor/"

checks:
    php:
        remove_extra_empty_lines: true
        remove_php_closing_tag: true
        remove_trailing_whitespace: true
        fix_use_statements:
            remove_unused: true
            preserve_multiple: false
            preserve_blanklines: true
            order_alphabetically: true
        #fix_php_opening_tag: true
        fix_linefeed: true
        fix_line_ending: true
        fix_identation_4spaces: true
        #fix_doc_comments: true

build:
    image: default-bionic
    environment:
        php:
            version: 8.1.2
    services:
        mysql: 5.7
    nodes:
        analysis:
            tests:
                override:
                    - php-scrutinizer-run
                    - js-scrutinizer-run
        coverage: 
            tests:
                before:
                  - command: 'cp .env.example .env'
                  - command: "mysql -e 'create database scrutinizer;'"
                 
                override:
                  - command: './vendor/bin/phpunit --coverage-clover=build/logs/clover.xml'
                    coverage:
                      file: build/logs/clover.xml   # <- Set this to where we find the coverage data.
                                                  #    The path is relative to the current directory.
                      format: clover

I checked the Scrutinizer documentation but I couldn't manage to find something useful to solve this issue.
What am I missing?

Davide Casiraghi
  • 15,591
  • 9
  • 34
  • 56

0 Answers0