build: false
clone_depth: 2
clone_folder: c:\projects\symfony

cache:
    - composer.phar
    - .phpunit -> phpunit

init:
    - SET PATH=c:\php;%PATH%
    - SET COMPOSER_NO_INTERACTION=1
    - SET SYMFONY_DEPRECATIONS_HELPER=strict
    - SET ANSICON=121x90 (121x90)
    - SET SYMFONY_PHPUNIT_DISABLE_RESULT_CACHE=1
    - SET SYMFONY_DEPRECATIONS_HELPER=max[indirect]=170
    - REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Command Processor" /v DelayedExpansion /t REG_DWORD /d 1 /f

install:
    - mkdir c:\php && cd c:\php
    - appveyor DownloadFile https://github.com/symfony/binary-utils/releases/download/v0.1/php-7.2.5-Win32-VC15-x86.zip
    - 7z x php-7.2.5-Win32-VC15-x86.zip -y >nul
    - cd ext
    - appveyor DownloadFile https://github.com/symfony/binary-utils/releases/download/v0.1/php_apcu-5.1.17-7.2-ts-vc15-x86.zip
    - 7z x php_apcu-5.1.17-7.2-ts-vc15-x86.zip -y >nul
    - cd ..
    - copy /Y php.ini-development php.ini-min
    - echo memory_limit=-1 >> php.ini-min
    - echo serialize_precision=-1 >> php.ini-min
    - echo max_execution_time=1200 >> php.ini-min
    - echo post_max_size=4G >> php.ini-min
    - echo upload_max_filesize=4G >> php.ini-min
    - echo date.timezone="America/Los_Angeles" >> php.ini-min
    - echo extension_dir=ext >> php.ini-min
    - echo extension=php_xsl.dll >> php.ini-min
    - copy /Y php.ini-min php.ini-max
    - echo zend_extension=php_opcache.dll >> php.ini-max
    - echo opcache.enable_cli=1 >> php.ini-max
    - echo extension=php_openssl.dll >> php.ini-max
    - echo extension=php_apcu.dll >> php.ini-max
    - echo apc.enable_cli=1 >> php.ini-max
    - echo extension=php_intl.dll >> php.ini-max
    - echo extension=php_mbstring.dll >> php.ini-max
    - echo extension=php_fileinfo.dll >> php.ini-max
    - echo extension=php_pdo_sqlite.dll >> php.ini-max
    - echo extension=php_curl.dll >> php.ini-max
    - copy /Y php.ini-max php.ini
    - cd c:\projects\symfony
    - IF NOT EXIST composer.phar (appveyor DownloadFile https://github.com/composer/composer/releases/download/2.0.0/composer.phar)
    - php composer.phar self-update --2
    - copy /Y .github\composer-config.json %APPDATA%\Composer\config.json
    - php composer.phar global require --no-progress --no-scripts --no-plugins symfony/flex
    - git config --global user.email ""
    - git config --global user.name "Symfony"
    - FOR /F "tokens=* USEBACKQ" %%F IN (`bash -c "grep ' VERSION = ' src/Symfony/Component/HttpKernel/Kernel.php | grep -o '[0-9][0-9]*\.[0-9]'"`) DO (SET SYMFONY_VERSION=%%F)
    - php .github/build-packages.php HEAD^ %SYMFONY_VERSION% src\Symfony\Bridge\PhpUnit
    - SET "SYMFONY_REQUIRE=>=%SYMFONY_VERSION%"
    - SET COMPOSER_ROOT_VERSION=%SYMFONY_VERSION%.x-dev
    - php composer.phar update --no-progress --ansi
    - php phpunit install

test_script:
    - SET X=0
    - SET SYMFONY_PHPUNIT_SKIPPED_TESTS=phpunit.skipped
    - copy /Y c:\php\php.ini-min c:\php\php.ini
    - IF %APPVEYOR_REPO_BRANCH:~-2% neq .x (rm -Rf src\Symfony\Bridge\PhpUnit)
    - mv src\Symfony\Component\HttpClient\phpunit.xml.dist src\Symfony\Component\HttpClient\phpunit.xml
    - php phpunit src\Symfony --exclude-group tty,benchmark,intl-data || SET X=!errorlevel!
    - php phpunit src\Symfony\Component\HttpClient || SET X=!errorlevel!
    - copy /Y c:\php\php.ini-max c:\php\php.ini
    - php phpunit src\Symfony --exclude-group tty,benchmark,intl-data || SET X=!errorlevel!
    - php phpunit src\Symfony\Component\HttpClient || SET X=!errorlevel!
    - exit %X%
