build: false
platform:
    - x64
clone_folder: C:\projects\maker-bundle

cache:
    - C:\projects\maker-bundle\vendor -> composer.json
    # Cache chocolatey packages
    - C:\ProgramData\chocolatey\bin -> .appveyor.yml
    - C:\ProgramData\chocolatey\lib -> .appveyor.yml
    # Cache php install
    - C:\tools\php -> .appveyor.yml
    - .phpunit -> phpunit

services:
  - mysql

init:
    - SET PATH=C:\Program Files\OpenSSL;C:\tools\php;%PATH%
    - SET COMPOSER_NO_INTERACTION=1
    - SET PHP=0 # This var is connected to PHP install cache
    - SET ANSICON=121x90 (121x90)
    - SET MAKER_DISABLE_FILE_LINKS=1
    - SET MAKER_SKIP_MERCURE_TEST=1

environment:
    TEST_DATABASE_DSN: mysql://root:Password12!@127.0.0.1:3306/test_maker
    matrix:
      - dependencies: highest
        php_ver_target: 7.2.5

install:
    - ps: Set-Service wuauserv -StartupType Manual
    - IF EXIST C:\tools\php (SET PHP=1) # Checks for the PHP install being cached
    - IF %PHP%==0 cinst --params '""/InstallDir:C:\tools\php""' --ignore-checksums -y php --version %php_ver_target%
    - cd C:\tools\php
    - IF %PHP%==0 copy php.ini-development php.ini /Y
    - IF %PHP%==0 echo memory_limit=-1 >> php.ini
    - IF %PHP%==0 echo serialize_precision=14 >> php.ini
    - IF %PHP%==0 echo realpath_cache_size=8192k >> php.ini
    - IF %PHP%==0 echo max_execution_time=1200 >> php.ini
    - IF %PHP%==0 echo date.timezone="UTC" >> php.ini
    - IF %PHP%==0 echo extension_dir=ext >> php.ini
    - IF %PHP%==0 echo opcache.enable_cli=1 >> php.ini
    - IF %PHP%==0 echo extension=php_openssl.dll >> php.ini
    - IF %PHP%==0 echo extension=php_mbstring.dll >> php.ini
    - IF %PHP%==0 echo extension=php_fileinfo.dll >> php.ini
    - IF %PHP%==0 echo extension=php_mysqli.dll >> php.ini
    - IF %PHP%==0 echo extension=php_curl.dll >> php.ini
    - IF %PHP%==0 echo extension=php_pdo_mysql.dll >> php.ini
    - IF %PHP%==0 echo @php %%~dp0composer.phar %%* > composer.bat
    - appveyor-retry appveyor DownloadFile https://getcomposer.org/composer-stable.phar
    - del composer.phar
    - rename composer-stable.phar composer.phar
    - cd C:\projects\maker-bundle
    - composer global require --no-progress --no-scripts --no-plugins symfony/flex
    - IF %dependencies%==highest appveyor-retry composer update --no-progress --no-suggest --ansi
    - composer install --no-interaction --no-progress --ansi --no-scripts --working-dir=tools/twigcs
    - composer install --no-interaction --no-progress --ansi --no-scripts --working-dir=tools/php-cs-fixer
    - vendor/bin/simple-phpunit install

test_script:
    - cd C:\projects\maker-bundle
    - vendor/bin/simple-phpunit
