<commit_before>language: php

services:
  - mysql

php:
  - 7.2

cache:
  directories:
    - $HOME/.composer/cache

before_install:
  # increase memory limit for all PHP processes
  - echo "memory_limit=4G" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini

  # turn off XDebug
  - phpenv config-rm xdebug.ini || return

  # install dependencies in parallel
  - travis_retry composer global require hirak/prestissimo

  # set to test environment for Symfony's commands in post install commands
  - export SYMFONY_ENV="test"

install:
  - composer install
  
before_script:
  - sudo apt-get update
  - sudo apt-get install apache2 libapache2-mod-fastcgi
  # enable php-fpm
  - sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf
  - sudo a2enmod rewrite actions fastcgi alias
  - echo "cgi.fix_pathinfo = 1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
  - sudo sed -i -e "s,www-data,travis,g" /etc/apache2/envvars
  - sudo chown -R travis:travis /var/lib/apache2/fastcgi
  - ~/.phpenv/versions/$(phpenv version-name)/sbin/php-fpm
  # configure apache virtual hosts
  - sudo cp -f travis/travis-ci-apache /etc/apache2/sites-available/000-default.conf
  - sudo sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place /etc/apache2/sites-available/000-default.conf
  - sudo service apache2 restart

script:
  # Copy our API library config into the tests/ folder
  - cp -a travis/local.config.php.dist tests/local.config.php

  # Clone Mautic staging branch from GitHub
  - git clone -b staging --single-branch --depth 1 https://github.com/mautic/mautic.git mautic

  # Copy our configuration file into the Mautic folder.
  - cp -a travis/overrides/app/config/local.php.dist mautic/app/config/local.php

  # Install Mautic
  - cd mautic
  - composer install
  - php app/console doctrine:database:create --no-interaction
  - php app/console mautic:install:data --force
  - php app/console mautic:plugins:reload
  - php app/console doctrine:migrations:version --add --all --no-interaction
<commit_msg>Enable Twilio plugin for MessagesTest<commit_after>language: php

services:
  - mysql

php:
  - 7.2

cache:
  directories:
    - $HOME/.composer/cache

before_install:
  # increase memory limit for all PHP processes
  - echo "memory_limit=4G" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini

  # turn off XDebug
  - phpenv config-rm xdebug.ini || return

  # install dependencies in parallel
  - travis_retry composer global require hirak/prestissimo

  # set to test environment for Symfony's commands in post install commands
  - export SYMFONY_ENV="test"

install:
  - composer install
  
before_script:
  - sudo apt-get update
  - sudo apt-get install apache2 libapache2-mod-fastcgi
  # enable php-fpm
  - sudo cp ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf.default ~/.phpenv/versions/$(phpenv version-name)/etc/php-fpm.conf
  - sudo a2enmod rewrite actions fastcgi alias
  - echo "cgi.fix_pathinfo = 1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
  - sudo sed -i -e "s,www-data,travis,g" /etc/apache2/envvars
  - sudo chown -R travis:travis /var/lib/apache2/fastcgi
  - ~/.phpenv/versions/$(phpenv version-name)/sbin/php-fpm
  # configure apache virtual hosts
  - sudo cp -f travis/travis-ci-apache /etc/apache2/sites-available/000-default.conf
  - sudo sed -e "s?%TRAVIS_BUILD_DIR%?$(pwd)?g" --in-place /etc/apache2/sites-available/000-default.conf
  - sudo service apache2 restart

script:
  # Copy our API library config into the tests/ folder
  - cp -a travis/local.config.php.dist tests/local.config.php

  # Clone Mautic staging branch from GitHub
  - git clone -b staging --single-branch --depth 1 https://github.com/mautic/mautic.git mautic

  # Copy our configuration file into the Mautic folder.
  - cp -a travis/overrides/app/config/local.php.dist mautic/app/config/local.php

  # Install Mautic
  - cd mautic
  - composer install
  - php app/console doctrine:database:create --no-interaction
  - php app/console mautic:install:data --force

  # Enable Twilio plugin with random credentials (needed for MessagesTest to function, doesn't actually contact Twilio API)
  - mysql -e 'UPDATE `plugin_integration_settings` SET is_published=1, supported_features='a:0:{}', api_keys='a:2:{s:8:\"username\";s:169:\"<KEY>s:8:\"password\";s:169:\"<KEY>}', feature_settings='a:4:{s:20:\"sending_phone_number\";N;s:22:\"disable_trackable_urls\";i:0;s:16:\"frequency_number\";N;s:14:\"frequency_time\";N;}' WHERE name = 'Twilio';'

  # Continue Mautic installation
  - php app/console mautic:plugins:reload
  - php app/console doctrine:migrations:version --add --all --no-interaction

{'fraction_non_alphanumeric': 0.12764158918005072, 'fraction_numerical': 0.012468300929839391, 'mean_word_length': 3.6040856031128405, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '283781', 'n_tokens_mistral': 1731, 'n_tokens_neox': 1648, 'n_words': 389}